mattloper / chumpy

MIT License
196 stars 120 forks source link

'import chumpy' fails: ImportError: cannot import name 'bool' from 'numpy' #55

Open yurivict opened 10 months ago

yurivict commented 10 months ago
>>> import chumpy
/usr/local/lib/python3.9/site-packages/chumpy/__init__.py:11: FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.
  from numpy import bool, int, float, complex, object, unicode, str, nan, inf
/usr/local/lib/python3.9/site-packages/chumpy/__init__.py:11: FutureWarning: In the future `np.object` will be defined as the corresponding NumPy scalar.
  from numpy import bool, int, float, complex, object, unicode, str, nan, inf
/usr/local/lib/python3.9/site-packages/chumpy/__init__.py:11: FutureWarning: In the future `np.str` will be defined as the corresponding NumPy scalar.
  from numpy import bool, int, float, complex, object, unicode, str, nan, inf
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/site-packages/chumpy/__init__.py", line 11, in <module>
    from numpy import bool, int, float, complex, object, unicode, str, nan, inf
ImportError: cannot import name 'bool' from 'numpy' (/usr/local/lib/python3.9/site-packages/numpy/__init__.py)
>>>

Version: 0.70 py39-numpy-1.25.0 Python-3.9 FreeBSD 14.0

yurivict commented 10 months ago

The documentation says that numpy has bool_, not bool.

kairusann commented 10 months ago

This issue was fixed recently but not yet sync up to PyPi (as discussed in #49), you can install the fixed version with pip install git+https://github.com/mattloper/chumpy

dlazares commented 8 months ago

thanks @kairusann! when pypi fix?

nubertj commented 3 months ago

would it be possible to update the pypi? The latest version in pypi is still 0.70, while the current master has 0.71 (which makes it hard to generate reproducible config files).

icedwater commented 2 months ago

fwiw I worked around it by downgrading numpy from 1.26.4 to 1.23.0 which seems to still be OK for my purposes, but I'll try the git+https approach later.

icedwater commented 2 months ago

fwiw I worked around it by downgrading numpy from 1.26.4 to 1.23.0 which seems to still be OK for my purposes, but I'll try the git+https approach later.

git+https works, as expected. I was able to use numpy 2.0.2, for reference. If it's OK for you to downgrade numpy as I did, there are now two workarounds available :)