Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix import triu #3548

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open

Fix import triu #3548

wants to merge 1 commit into from

Conversation

Hoasker
Copy link

@Hoasker Hoasker commented Jul 18, 2024

I'm using scipy 1.13.1 and it works in manual fix. I found scipy in the documentation starting with version 1.12.0, but it appeared in the source code much earlier. The triu function has been moved from scipy.linalg to scipy.sparse. I changed imports:

try:
    from numpy import triu
except ImportError:
    from scipy.linalg import triu

to from scipy.sparse import triu and it worked.

I'm using scipy 1.13.1 and it works in manual fix. I found scipy in the documentation starting with version 1.12.0, but it appeared in the source code much earlier. The triu function has been moved from scipy.linalg to scipy.sparse. I changed the imports 
```try:
    from numpy import triu
except ImportError:
    from scipy.linalg import triu``` 
to ```from scipy.sparse import triu``` and it worked.
@Crosswind
Copy link

scipy suggests to import triu from numpy. The change to numpy was introduced only a short while back in ad68ee3 and has been working. What exact problem are you trying to fix with this PR?

@Hoasker
Copy link
Author

Hoasker commented Jul 18, 2024

scipy suggests to import triu from numpy. The change to numpy was introduced only a short while back in ad68ee3 and has been working. What exact problem are you trying to fix with this PR?

triu from numpy for some reason did not fix the problem when run program. And this method fixed it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants