h5py: Error using h5r>init h5py.h5r (line 145) AttributeError: type object 'h5py.h5r.Reference' has no attribute '__reduce_cython__'

  • Operating System Windows 7 enterprise
  • Python version 3.6.7 Anaconda installation
  • Matlab 9.1.0.441655 (R2016b) pyversion ‘C:\ProgramData\Anaconda3\envs\tensorflow\python.exe’ … = py.importlib.import_module(‘file_name’);
  • h5py version 2.9.0
  • HDF5 version 1.10.4

Hello,

I want to use tensorflow via matlab as above. I can import tensorflow and h5py both without any problems in the console. When I want to use it together with matlab I get the error:

Error: Python Error: AttributeError: type object 'h5py.h5r.Reference' has no attribute '__reduce_cython__'
init h5py.h5r at 145
init h5py._conv at 21
<module> at 36
<module> at 38
<module> at 39
<module> at 43
<module> at 22
<module> at 35
<module> at 24
<module> at 24
<module> at 88
<module> at 24
<module> at 2
_call_with_frames_removed at 219
exec_module at 678
_load_unlocked at 665
_find_and_load_unlocked at 955
_find_and_load at 971
_gcd_import at 994
import_module at 126
Error using h5r>init h5py.h5r (line 145)
Python Error: AttributeError: type object 'h5py.h5r.Reference' has no attribute
'__reduce_cython__'

Error in h5r>init h5py._conv (line 21)

Error in __init__><module> (line 36)
from ._conv import register_converters as _register_converters

Error in saving><module> (line 38)
  import h5py

Error in network><module> (line 39)
from tensorflow.python.keras.engine import saving

Error in training><module> (line 43)
from tensorflow.python.keras.engine.network import Network

Error in multi_gpu_utils><module> (line 22)
from tensorflow.python.keras.engine.training import Model

Error in __init__><module> (line 35)
from tensorflow.python.keras.utils.multi_gpu_utils import multi_gpu_model

Error in activations><module> (line 24)
from tensorflow.python.keras.utils.generic_utils import deserialize_keras_object

Error in __init__><module> (line 24)
from tensorflow.python.keras import activations

Error in __init__><module> (line 88)
from tensorflow.python import keras

Error in __init__><module> (line 24)
from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import

Error in demo_regression_UCI><module> (line 2)
import tensorflow as tf

Error in <frozen importlib>_call_with_frames_removed (line 219)

Error in <frozen importlib>exec_module (line 678)

Error in <frozen importlib>_load_unlocked (line 665)

Error in <frozen importlib>_find_and_load_unlocked (line 955)

Error in <frozen importlib>_find_and_load (line 971)

Error in <frozen importlib>_gcd_import (line 994)

Error in __init__>import_module (line 126)
    return _bootstrap._gcd_import(name[level:], package, level)

Error in Deep_GP_Doubly_Model/modelfit (line 181)
obj.loadPythonModule();

Can you help me with this? Do you know what is the problem?

Thanks.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 17 (1 by maintainers)

Most upvoted comments

I had h5py-2.9.0 installed and got this issue. Followed @robisen1 suggestion and installed 2.8.0 conda install h5py=2.8.0 Fixed the problem for me

The main issue seems to be around what version of h5py you are using. This is how I dealt with the issue https://robipsen.wordpress.com/2019/05/31/dealing-with-attributeerror-type-object-h5py-h5r-reference-has-no-attribute-__reduce_cython__/

@PeterJPRoche , @robisen1 @Michael-VT god bless you. it solved my issue too

conda install h5py==2.8.0 // in Anacoda3 pip install h5py==2.8.0 // in Windows 10 Fixed the problem for me

@robisen1 I didn’t solve this problem, but I found a way around it. I simply uninstalled h5py from my environment and then used pickle to save stuff instead of the .h5-format. Anyway, thanks for answering!

glad my pain helped someone 😃 very annoying issue that

On Mon, Jun 10, 2019 at 3:33 PM Peter notifications@github.com wrote:

I had h5py-2.9.0 installed and got this issue. Followed @robisen1 https://github.com/robisen1 suggestion and installed 2.8.0 conda install h5py=2.8.0 Fixed the problem for me

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/h5py/h5py/issues/1151?email_source=notifications&email_token=ABSF2RNRQPL7YLWXAHGO22DPZ3JE3A5CNFSM4GMWBT62YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXLNOHI#issuecomment-500619037, or mute the thread https://github.com/notifications/unsubscribe-auth/ABSF2RIJUFLVLTY7MBQ2RGDPZ3JE3ANCNFSM4GMWBT6Q .