PhilippAumann / circuitq

Toolbox for the simulation and analysis of superconducting circuits.
MIT License
39 stars 9 forks source link

spa.linalg.eigsh import does not work correctly #1

Closed alelandra closed 3 years ago

alelandra commented 3 years ago
import scipy.sparse as spa
evals, estates = spa.linalg.eigsh(self.h_num, k=self.n_eig, which='SA' ,v0=v0) 

does not work in my installation with the latest scipy and python. The reason is this https://stackoverflow.com/questions/65909046/module-scipy-sparse-has-no-attribute-linalg-error-in-reticulate-virtual-envi

and can be easily fixed by doing

import scipy.sparse.linalg
 evals, estates = scipy.sparse.linalg.eigsh(self.h_num, k=self.n_eig, which='SA',v0=v0)
PhilippAumann commented 3 years ago

Thank you for the issue. For reproducing the error, can you give me the exact versions of scipy and python which you are using?

alelandra commented 3 years ago

Hi there :) I am using python 3.9.6 inside a Venv https://docs.python.org/3/library/venv.html and scipy 1.7.0 (which is the second last version I have just noticed). Thank you!

PhilippAumann commented 3 years ago

I was able to reproduce the error

AttributeError: module 'scipy.sparse' has no attribute 'linalg'

using Python 3.9.6 with Scipy 1.6.2. Didn't run into that before, since I have been using an older version. Thank's for pointing this out. I will have a more careful look on it and fix it.

alelandra commented 3 years ago

thank you!

PhilippAumann commented 3 years ago

Should be fixed now, if it still doesn't work let me know, otherwise we can close the issue. Note, that you will have to update your local version via git, as I haven't uploaded an updated version on PyPI yet.