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

Versions of numpy starting in 2.X will fail due to bool8 data-type being removed #35

Closed
ssssarah opened this issue Oct 29, 2024 · 4 comments

Comments

@ssssarah
Copy link

ssssarah commented Oct 29, 2024

https://numpy.org/devdocs/release/2.0.0-notes.html

#Support for seven data type string aliases has been removed from np.dtype: int0, uint0, void0, object0, str0, bytes0 and bool8.
(gh-24807)

Traceback (most recent call last):
  File "./src/my_script.py", line 9, in <module>
    from voxcell import RegionMap, VoxelData
  File "./venv2/lib/python3.11/site-packages/voxcell/__init__.py", line 6, in <module>
    from voxcell.voxel_data import (
  File "./venv2/lib/python3.11/site-packages/voxcell/voxel_data.py", line 4, in <module>
    import nrrd
  File "./venv2/lib/python3.11/site-packages/nrrd/__init__.py", line 2, in <module>
    from nrrd.formatters import *
  File "./venv2/lib/python3.11/site-packages/nrrd/formatters.py", line 3, in <module>
    import nptyping as npt
  File "./venv2/lib/python3.11/site-packages/nptyping/__init__.py", line 30, in <module>
    from nptyping.ndarray import NDArray
  File "./venv2/lib/python3.11/site-packages/nptyping/ndarray.py", line 32, in <module>
    from nptyping.shape_expression import (
  File "./venv2/lib/python3.11/site-packages/nptyping/shape_expression.py", line 35, in <module>
    from nptyping.typing_ import Literal
  File "./venv2/lib/python3.11/site-packages/nptyping/typing_.py", line 66, in <module>
    Bool8: TypeAlias = np.bool8
                       ^^^^^^^^
  File "./venv2/lib/python3.11/site-packages/numpy/__init__.py", line 410, in __getattr__
    raise AttributeError("module {!r} has no attribute "
AttributeError: module 'numpy' has no attribute 'bool8'. Did you mean: 'bool'?

Looks like this is not directly a voxcell issue but maybe capping the numpy version can help prevent this problem?

@mgeplf
Copy link
Collaborator

mgeplf commented Oct 30, 2024

Capping the numpy would be dangerous, since it impacts the resolver, and it's not really a hard dependency.

@eleftherioszisis successfully got pynrrd to drop it, so once that's released, we should be in the clear: mhe/pynrrd#154

@ssssarah
Copy link
Author

Cool, indeed it's much better. Thanks!

@mgeplf
Copy link
Collaborator

mgeplf commented Oct 30, 2024

We'll have to see when a release is made, perhaps I will ping the maintainer.

@mgeplf
Copy link
Collaborator

mgeplf commented Nov 8, 2024

A release has been made, so nptyping isn't used, and this error will go away.
However, their API has changed, so we have another thing to fix: #37

@mgeplf mgeplf closed this as completed Nov 8, 2024
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

No branches or pull requests

2 participants