Recently I was working on a Neural Network to classify some radio frequency signal data and ran into an issue I never have had before. I was using a Conda Environment, I like Anaconda, that I had been using Keras and Tensorflow with for some time. Recently though I updated all the packages in that environment. So when I tried to test my neural network from Spyder I kept getting ‘AttributeError: type object ‘h5py.h5r.Reference’ has no attribute ‘__reduce_cython__”.
My system was using the latest version of Keras, Tensorflow etc. After doing some googling I found a lot of people having similar issues but this thread seemed to be the best https://github.com/cython/cython/issues/1953#issuecomment-398128940. For me, the issue was definitely related to the version of h5py I had installed. When I tried to update h5py it would only update it to 2.7.7. I ended up doing conda install h5py=2.8.0 and that worked. In general, this seems to resolve the issues for most people having this issue but for folks using python or anaconda python its very important to look at your packages, I use conda list or conda list package, to not only check what packages are installed but also that when you do something like conda update h5py that its actually installing a recent version, not an old one. Indeed depending on your setup, and how you update your packages and environment, your package manager might be installing older versions of packages to resolve issues.