question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue
  • 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.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:17 (1 by maintainers)

github_iconTop GitHub Comments

8reactions
PeterJPRochecommented, Jun 10, 2019

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

4reactions
robisen1commented, May 31, 2019

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__/

Read more comments on GitHub >

github_iconTop Results From Across the Web

AttributeError: type object 'h5py.h5r.Reference' has no ...
I got the solution. It was because I was importing both HDF5Matrix and tables in same program. Due to some reason both cannot...
Read more >
Dealing with 'AttributeError: type object 'h5py.h5r.Reference ...
So when I tried to test my neural network from Spyder I kept getting 'AttributeError: type object 'h5py.h5r.Reference' has no attribute ...
Read more >
FAQ — h5py 3.7.0 documentation
Below is a complete list of types for which h5py supports reading, writing and creating datasets. Each type is mapped to a native...
Read more >
问题AttributeError type object h5py.h5r.Reference has no ...
写在前边:前提:没有'__reduce_cython__'属性报错展示:AttributeError: type object 'h5py.h5r.Reference' has no attribute '__reduce_cython__' ...
Read more >
成功解决AttributeError: type object 'h5py.h5r.Reference' has ...
... object 'h5py.h5r.Reference' has no attribute '__reduce_cython__', ... File "h5py\h5r.pyx", line 145, in init h5py.h5r AttributeError: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found