aleju / imgaug

Image augmentation for machine learning experiments.
http://imgaug.readthedocs.io
MIT License
14.43k stars 2.44k forks source link

Scipy version update causes error importing 'bmat' #770

Open jamjahal opened 3 years ago

jamjahal commented 3 years ago

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

hoult14 commented 2 years ago

I have the same question, so how do you solve this problem?

mrevow commented 2 years ago

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

big-sha-fang commented 1 year ago

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'