h5py: no-binary h5py missing attributes, e.g. __version__

  • Operating System Ubuntu 22.04.2 LTS
  • Python version 3.10.6
  • Where Python was acquired: system Python
  • h5py version 3.8.0
  • HDF5 version 1.10.7
  • The full traceback/stack trace shown (if it appears)
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: module 'h5py' has no attribute '__version__'

Due to conflicting versions of h5py and hdf5, I am forced to build the no-binary version of h5py, just to get pass the error

Warning! ***HDF5 library version mismatched error***

which causes my program to crash. However, after building the no-binary version, it then fails for a different reason, claiming it’s missing the File attribute. It is not the only attribute it’s missing, as I write above, also the __version__ and version atributes are missing.

Is this a problem on my end? Or an issue with the no-binary version?

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 28 (15 by maintainers)

Most upvoted comments

if anyone will be stumbling here even after upgrading pip, make sure to also upgrade setuptools! On the Ubuntu 22.04 I had:

$ pip show setuptools
Name: setuptools
Version: 59.6.0

and I was getting the same issue (only libraries installed) even after upgrading pip. So make sure to do pip install --upgrade setuptools pip !

I would make sure you have the build requirements in your working environment, then do

pip install setuptools==X.Y.Z
pip install --no-build-isolation .

until you find a version that works. You could also change the pinning in pyproject.toml and rebuild to the same effect.

by “shell”, I think Thomas meant “Python or IPython shell”. I agree that it is likely something is snarled with your local installations (particually if you ended up with a --user install in .local. I suggest at least clearing that out.

Can you provide some more details about how you did the installation and the full traceback?

Other guesses of what is going wrong are:

  • pip and the version of Python you are using are not the same Python
  • you have “chimera” installations where you have some files from one version of h5py and some from another
  • you did sudo pip install ... which is almost never a good idea