I did get this exact error while trying to import TensorFlow after installation, but I was able to get around this by upgrading the h5py
library. There is no need to degrade the NumPy library, as doing so might cause compatibility issues with other libraries that rely on the upgraded version.
pip install --upgrade h5py
If you check the error message well, you will notice these lines, which state the possible causes:
File “h5py\h5t.pxd”, line 14, in init h5py.conv
File “h5py\h5t.pyx”, line 293, in init h5py.h5t
File "C:\Users\user\anaconda3\envs\myenv\lib\site-packages\numpy_init.py", line 320, in getattr
raise AttributeError("module {!r} has no attribute ")
The solution that does not involve degrading any library is to upgrade the h5py
library.
numpy
etc. This may be too soon to use numpy 1.24. Other packages might not have adjusted to the changes, especially the deprecated features.