AttributeError: module 'numpy' has no attribute 'float' while importing nibabel

429 Views Asked by At

When i try to install nibabel lirary i get an error like this. Tried different version of numpy and didn't work out. Any idea how to solve this?

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-2-954ce44cd9c4> in <module>
----> 1 import nibabel as nb
      2 import matplotlib.pyplot as plt
      3 import numpy as np
      4 import sys

3 frames
/usr/local/lib/python3.9/dist-packages/numpy/__init__.py in __getattr__(attr)
    303 
    304         if attr in __former_attrs__:
--> 305             raise AttributeError(__former_attrs__[attr])
    306 
    307         # Importing Tester requires importing all of UnitTest which is not a

AttributeError: module 'numpy' has no attribute 'float'.
`np.float` was a deprecated alias for the builtin `float`. To avoid this error in existing code, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

To get an solution for an error i am facing.

1

There are 1 best solutions below

0
Chris Markiewicz On

This is a version incompatibility in your environment. This bug was fixed in https://github.com/nipy/nibabel/pull/964, which was included in the 3.2.1 release.

To resolve this, you either need to upgrade nibabel or downgrade numpy.