Scipy version update causes error importing 'bmat'
jamjahal opened this issue · 3 comments
Hi, When importing imgaug i get the error cannot import 'bmat' from 'scipy.sparse.sputils'
. Looking at the traceback error shows that the file /opt/anaconda3/envs/deep_learning/lib/python3.8/site-packages/scipy/sparse/linalg/eigen/lobpcg/lobpcg.py
is attempting to import bmat from ---> 24 from scipy.sparse.sputils import bmat
.
bmat has apparently been moved to scipy.sparse.bmat
. Changing this line in the above file solved the error.
scipy = 1.5.4
python = 3.8.0
imgaug = 0.4.0
I have the same question, so how do you solve this problem?
I just ran into the same issue after upgrading my scipy version. I got
ImportError: cannot import name 'bmat' from 'scipy.sparse.sputils'
It turns out that this commit renamed scipy/sparse/linalg/eigen -> scipy/sparse/linalg/_eigen When I upgraded the, old directory did not get deleted. I ended up with both _eigen and eigen. Python was loading the the old version
I just renamed site-packages/scipy/sparse/linalg/eigen -> site-packages/scipy/sparse/linalg/eigenDeprecated in my installation which fixed the issue
the error happens because 'bmat' is moved to 'numpy'.
solution: open 'scipy/sparse/linalg/eigen/lobpcg/lobpcg.py' and change 'import bmat from 'scipy.sparse.sputils' to 'import bmat from numpy'