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.

Unable to install h5py 3.4

See original GitHub issue

To assist reproducing bugs, please include the following:

  • Operating System (e.g. Windows 10, MacOS 10.11, Ubuntu 16.04.2 LTS, CentOS 7) Ubuntu 20.04 LTS
  • Python version (e.g. 2.7, 3.5) 3.8
  • Where Python was acquired (e.g. system Python on MacOS or Linux, Anaconda on Windows) system python
  • h5py version (e.g. 2.6) 3.4
  • HDF5 version (e.g. 1.8.17) 1.12.0
  • The full traceback/stack trace shown (if it appears) I am getting this error when I type python3.8 setup.py install
running install
running bdist_egg
running egg_info
writing h5py.egg-info/PKG-INFO
writing dependency_links to h5py.egg-info/dependency_links.txt
writing requirements to h5py.egg-info/requires.txt
writing top-level names to h5py.egg-info/top_level.txt
reading manifest file 'h5py.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'AUTHORS'
no previously-included directories found matching 'docs/_build'
no previously-included directories found matching 'docs_api/_build'
warning: no previously-included files matching '.DS_Store' found under directory '*'
warning: no previously-included files found matching 'ci'
warning: no previously-included files found matching 'other'
warning: no previously-included files found matching '.github'
warning: no previously-included files matching '*' found under directory 'ci'
warning: no previously-included files matching '*' found under directory 'other'
warning: no previously-included files matching '*' found under directory '.github'
warning: no previously-included files found matching '*.yml'
warning: no previously-included files found matching '*.yaml'
warning: no previously-included files matching '__pycache__' found under directory '*'
warning: no previously-included files matching '*.py[co]' found under directory '*'
warning: no previously-included files found matching '.coveragerc'
warning: no previously-included files found matching '.coverage_dir'
warning: no previously-included files matching '*' found under directory '.coverage_dir'
warning: no previously-included files found matching '.mailmap'
warning: no previously-included files found matching 'github_deploy_key_h5py_h5py.enc'
warning: no previously-included files found matching 'rever.xsh'
no previously-included directories found matching 'news'
writing manifest file 'h5py.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
running build_ext
Loading library to get build settings and version: libhdf5.so
********************************************************************************
                       Summary of the h5py configuration

HDF5 include dirs: []
HDF5 library dirs: []
     HDF5 Version: (1, 12, 0)
      MPI Enabled: False
 ROS3 VFD Enabled: False
 Rebuild Required: True

********************************************************************************
Executing cythonize()
Traceback (most recent call last):
  File "setup.py", line 156, in <module>
    setup(
  File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 144, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib/python3.8/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib/python3.8/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/usr/lib/python3/dist-packages/setuptools/command/install.py", line 67, in run
    self.do_egg_install()
  File "/usr/lib/python3/dist-packages/setuptools/command/install.py", line 109, in do_egg_install
    self.run_command('bdist_egg')
  File "/usr/lib/python3.8/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/usr/lib/python3/dist-packages/setuptools/command/bdist_egg.py", line 172, in run
    cmd = self.call_command('install_lib', warn_dir=0)
  File "/usr/lib/python3/dist-packages/setuptools/command/bdist_egg.py", line 158, in call_command
    self.run_command(cmdname)
  File "/usr/lib/python3.8/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/usr/lib/python3/dist-packages/setuptools/command/install_lib.py", line 23, in run
    self.build()
  File "/usr/lib/python3.8/distutils/command/install_lib.py", line 109, in build
    self.run_command('build_ext')
  File "/usr/lib/python3.8/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/home/winash12/libPython/h5py-3.4.0/setup_build.py", line 170, in run
    self.extensions = cythonize(self._make_extensions(config),
  File "/usr/local/lib/python3.8/dist-packages/Cython-0.29.24-py3.8-linux-x86_64.egg/Cython/Build/Dependencies.py", line 963, in cythonize
    ctx = c_options.create_context()
  File "/usr/local/lib/python3.8/dist-packages/Cython-0.29.24-py3.8-linux-x86_64.egg/Cython/Compiler/Main.py", line 596, in create_context
    return Context(self.include_path, self.compiler_directives,
  File "/usr/local/lib/python3.8/dist-packages/Cython-0.29.24-py3.8-linux-x86_64.egg/Cython/Compiler/Main.py", line 80, in __init__
    from . import Builtin, CythonScope
  File "/usr/local/lib/python3.8/dist-packages/Cython-0.29.24-py3.8-linux-x86_64.egg/Cython/Compiler/CythonScope.py", line 5, in <module>
    from .UtilityCode import CythonUtilityCode
  File "/usr/local/lib/python3.8/dist-packages/Cython-0.29.24-py3.8-linux-x86_64.egg/Cython/Compiler/UtilityCode.py", line 3, in <module>
    from .TreeFragment import parse_from_strings, StringParseContext
  File "/usr/local/lib/python3.8/dist-packages/Cython-0.29.24-py3.8-linux-x86_64.egg/Cython/Compiler/TreeFragment.py", line 17, in <module>
    from .Visitor import VisitorTransform
  File "Cython/Compiler/Visitor.py", line 16, in init Cython.Compiler.Visitor
  File "/usr/local/lib/python3.8/dist-packages/Cython-0.29.24-py3.8-linux-x86_64.egg/Cython/Compiler/Nodes.py", line 31, in <module>
    from .Pythran import has_np_pythran, pythran_type, is_pythran_buffer
  File "/usr/local/lib/python3.8/dist-packages/Cython-0.29.24-py3.8-linux-x86_64.egg/Cython/Compiler/Pythran.py", line 10, in <module>
    import pythran
  File "/usr/local/lib/python3.8/dist-packages/pythran-0.9.12.post1-py3.8.egg/pythran/__init__.py", line 41, in <module>
    from pythran.toolchain import (generate_cxx, compile_cxxfile, compile_cxxcode,
  File "/usr/local/lib/python3.8/dist-packages/pythran-0.9.12.post1-py3.8.egg/pythran/toolchain.py", line 6, in <module>
    from pythran.backend import Cxx, Python
  File "/usr/local/lib/python3.8/dist-packages/pythran-0.9.12.post1-py3.8.egg/pythran/backend.py", line 7, in <module>
    from pythran.analyses import LocalNodeDeclarations, GlobalDeclarations, Scope
  File "/usr/local/lib/python3.8/dist-packages/pythran-0.9.12.post1-py3.8.egg/pythran/analyses/__init__.py", line 12, in <module>
    from .aliases import Aliases, StrictAliases
  File "/usr/local/lib/python3.8/dist-packages/pythran-0.9.12.post1-py3.8.egg/pythran/analyses/aliases.py", line 6, in <module>
    from pythran.syntax import PythranSyntaxError
  File "/usr/local/lib/python3.8/dist-packages/pythran-0.9.12.post1-py3.8.egg/pythran/syntax.py", line 7, in <module>
    from pythran.tables import MODULES
  File "/usr/local/lib/python3.8/dist-packages/pythran-0.9.12.post1-py3.8.egg/pythran/tables.py", line 4580, in <module>
    save_arguments((), MODULES)
  File "/usr/local/lib/python3.8/dist-packages/pythran-0.9.12.post1-py3.8.egg/pythran/tables.py", line 4547, in save_arguments
    save_arguments(module_name + (elem,), signature)
  File "/usr/local/lib/python3.8/dist-packages/pythran-0.9.12.post1-py3.8.egg/pythran/tables.py", line 4547, in save_arguments
    save_arguments(module_name + (elem,), signature)
  File "/usr/local/lib/python3.8/dist-packages/pythran-0.9.12.post1-py3.8.egg/pythran/tables.py", line 4551, in save_arguments
    themodule = __import__(".".join(module_name))
  File "/usr/local/lib/python3.8/dist-packages/scipy-1.7.1-py3.8-linux-x86_64.egg/scipy/special/__init__.py", line 643, in <module>
    from . import _ufuncs
  File "_ufuncs.pyx", line 1, in init scipy.special._ufuncs
ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:14 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
winash12commented, Aug 31, 2021

@tacaswell That is great ! I just did a pip3 install --no-binary=h5py h5py and it compiled and installed just fine. No more sudo setup.py for me ! Finally can close this issue for good.

1reaction
tacaswellcommented, Aug 31, 2021

Have not had an issue with sudo in 7 years of Ubuntu.

This is a similar statement to “I have ridden by bike with out a helmet for years without issues”. You should be thankful you got lucky!

There has been enough trouble with sudo + python installation that some distributions have patched pip to fail with sudo and there is an active PEP (https://discuss.python.org/t/graceful-cooperation-between-external-and-python-package-managers-pep-668/10302 / https://github.com/python/peps/blob/013d50de0e07aa9e7fecc8dc3cd55b115c12ddf4/pep-0668.rst) on how to make sure that pip and system package managers play nice!


If you run python setup.py you do indeed get a .eggs directory with cython and numpy due to our use of setup_requires in setup.py: https://github.com/h5py/h5py/blob/a7c3f0c1b5faf01ec3f53af4947eeae971c7fbea/setup.py#L46-L54 and https://github.com/h5py/h5py/blob/a7c3f0c1b5faf01ec3f53af4947eeae971c7fbea/setup.py#L178-L180

If you use pip install . rather that python setup.py install you can avoid creating the eggs.


That said, if you want to use system python without a virtual env, please use the h5py packaged my your system packager (in your case managed via apt).

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - Can't install h5py - Stack Overflow
The first found workaround for me was installing h5py from https://www.lfd.uci.edu/~gohlke/pythonlibs/#h5py , which, although seems being quite ...
Read more >
Installation — h5py 3.7.0 documentation
After installing h5py, you should run the tests to be sure that everything was installed correctly. This can be done in the python...
Read more >
Install issue while building h5py (pyproject.toml) #2035 - GitHub
But I got error like this. $ pip3 install h5py DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will ...
Read more >
h5py - PyPI
The h5py package provides both a high- and low-level interface to the HDF5 library from Python. The low-level interface is intended to be...
Read more >
[Solved] Failed building wheel for h5py in Python | bobbyhadz
The error "Failed building wheel for h5py" is sometimes caused when the package you are trying to install doesn't have available wheels for...
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