AttributeError: type object 'h5py.h5.H5PYConfig' has no attribute '__reduce_cython__'

Viewed 21062

I've tried to reinstall h5py hdp5 etc. My conda version is 4.9.2 python 3.8.5 Is there anyone with a similar issue ? Is there an alternative to h5py ?

Traceback (most recent call last):

  File "D:\X_train.h5\test.py", line 17, in <module>
    import h5py

  File "C:\ProgramData\Anaconda3\lib\site-packages\h5py\__init__.py", line 34, in <module>
    from . import version

  File "C:\ProgramData\Anaconda3\lib\site-packages\h5py\version.py", line 17, in <module>
    from . import h5 as _h5

  File "h5py\h5.pyx", line 1, in init h5py.h5

ImportError: DLL load failed while importing defs: La procédure spécifiée est introuvable.


runfile('D:/X_train.h5/test.py', wdir='D:/X_train.h5')
Traceback (most recent call last):

  File "D:\X_train.h5\test.py", line 17, in <module>
    import h5py

  File "C:\ProgramData\Anaconda3\lib\site-packages\h5py\__init__.py", line 34, in <module>
    from . import version

  File "C:\ProgramData\Anaconda3\lib\site-packages\h5py\version.py", line 17, in <module>
    from . import h5 as _h5

  File "h5py\h5.pyx", line 41, in init h5py.h5

AttributeError: type object 'h5py.h5.H5PYConfig' has no attribute '__reduce_cython__'
5 Answers

This is a fixed bug in the h5py's interface. Try:

pip install --upgrade h5py

You should try:

pip install h5py==2.9

Uninstall all older h5py. Then this command:

conda install -c anaconda h5py

Some packages like tensorflow 2.6 need you to downgrade h5py. Try pip install h5py==3.1

Refer this image:

Refer this image

pip install --upgrade h5py

This will update your package and tell us the right version needed for Tensorflow

pip install h5py==version

In my case, I had TensorFlow 2.5.0 which needed h5py=3.1.0

Related