h5py: pip install fails on Cython dependency
This is on Debian wheezy.
For some reason, the Cython dependency doesn’t work as it should. I see that there has been quite some refactoring in setup.py and Cython is listed in both requires and install_requires, so I really don’t know why that doesn’t work.
As you can see, pip correctly fetches h5py, numpy and Cython and then proceeds to install them in that order.
martijn@hue:~$ virtualenv /tmp/h5py
New python executable in /tmp/h5py/bin/python
Installing setuptools, pip...done.
martijn@hue:~$ /tmp/h5py/bin/pip install h5py
Downloading/unpacking h5py
Downloading h5py-2.4.0.tar.gz (172kB): 172kB downloaded
Running setup.py (path:/tmp/h5py/build/h5py/setup.py) egg_info for package h5py
warning: no previously-included files found matching 'h5py/defs.pyx'
warning: no previously-included files found matching 'h5py/defs.pxd'
warning: no previously-included files found matching 'h5py/config.pxi'
Downloading/unpacking numpy>=1.6.1 (from h5py)
Downloading numpy-1.9.1.tar.gz (4.0MB): 4.0MB downloaded
Running setup.py (path:/tmp/h5py/build/numpy/setup.py) egg_info for package numpy
Running from numpy source directory.
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '*.pyo' found anywhere in distribution
warning: no previously-included files matching '*.pyd' found anywhere in distribution
Downloading/unpacking Cython>=0.17 (from h5py)
Downloading Cython-0.21.2.tar.gz (1.5MB): 1.5MB downloaded
Running setup.py (path:/tmp/h5py/build/Cython/setup.py) egg_info for package Cython
Compiling module Cython.Plex.Scanners ...
Compiling module Cython.Plex.Actions ...
Compiling module Cython.Compiler.Lexicon ...
Compiling module Cython.Compiler.Scanning ...
Compiling module Cython.Compiler.Parsing ...
Compiling module Cython.Compiler.Visitor ...
Compiling module Cython.Compiler.FlowControl ...
Compiling module Cython.Compiler.Code ...
Compiling module Cython.Runtime.refnanny ...
Compiling module Cython.Tempita._tempita ...
warning: no files found matching '*.pyx' under directory 'Cython/Debugger/Tests'
warning: no files found matching '*.pxd' under directory 'Cython/Debugger/Tests'
warning: no files found matching '*.h' under directory 'Cython/Debugger/Tests'
warning: no files found matching '*.pxd' under directory 'Cython/Utility'
Installing collected packages: h5py, numpy, Cython
Running setup.py install for h5py
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/h5py/build/h5py/setup.py", line 147, in <module>
cmdclass = CMDCLASS,
File "/usr/lib/python2.7/distutils/core.py", line 152, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "build/bdist.linux-x86_64/egg/setuptools/command/install.py", line 61, in run
File "/usr/lib/python2.7/distutils/command/install.py", line 601, in run
self.run_command('build')
File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/usr/lib/python2.7/distutils/command/build.py", line 128, in run
self.run_command(cmd_name)
File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "setup_build.py", line 99, in run
from Cython.Build import cythonize
ImportError: No module named Cython.Build
Complete output from command /tmp/h5py/bin/python -c "import setuptools, tokenize;__file__='/tmp/h5py/build/h5py/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-nyKOEl-record/install-record.txt --single-version-externally-managed --compile --install-headers /tmp/h5py/include/site/python2.7:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/h5py
copying h5py/version.py -> build/lib.linux-x86_64-2.7/h5py
copying h5py/__init__.py -> build/lib.linux-x86_64-2.7/h5py
copying h5py/highlevel.py -> build/lib.linux-x86_64-2.7/h5py
copying h5py/ipy_completer.py -> build/lib.linux-x86_64-2.7/h5py
creating build/lib.linux-x86_64-2.7/h5py/_hl
copying h5py/_hl/selections2.py -> build/lib.linux-x86_64-2.7/h5py/_hl
copying h5py/_hl/__init__.py -> build/lib.linux-x86_64-2.7/h5py/_hl
copying h5py/_hl/attrs.py -> build/lib.linux-x86_64-2.7/h5py/_hl
copying h5py/_hl/dataset.py -> build/lib.linux-x86_64-2.7/h5py/_hl
copying h5py/_hl/base.py -> build/lib.linux-x86_64-2.7/h5py/_hl
copying h5py/_hl/dims.py -> build/lib.linux-x86_64-2.7/h5py/_hl
copying h5py/_hl/group.py -> build/lib.linux-x86_64-2.7/h5py/_hl
copying h5py/_hl/files.py -> build/lib.linux-x86_64-2.7/h5py/_hl
copying h5py/_hl/selections.py -> build/lib.linux-x86_64-2.7/h5py/_hl
copying h5py/_hl/datatype.py -> build/lib.linux-x86_64-2.7/h5py/_hl
copying h5py/_hl/filters.py -> build/lib.linux-x86_64-2.7/h5py/_hl
creating build/lib.linux-x86_64-2.7/h5py/tests
copying h5py/tests/__init__.py -> build/lib.linux-x86_64-2.7/h5py/tests
copying h5py/tests/common.py -> build/lib.linux-x86_64-2.7/h5py/tests
creating build/lib.linux-x86_64-2.7/h5py/tests/old
copying h5py/tests/old/test_dataset.py -> build/lib.linux-x86_64-2.7/h5py/tests/old
copying h5py/tests/old/test_h5.py -> build/lib.linux-x86_64-2.7/h5py/tests/old
copying h5py/tests/old/__init__.py -> build/lib.linux-x86_64-2.7/h5py/tests/old
copying h5py/tests/old/test_slicing.py -> build/lib.linux-x86_64-2.7/h5py/tests/old
copying h5py/tests/old/test_dimension_scales.py -> build/lib.linux-x86_64-2.7/h5py/tests/old
copying h5py/tests/old/test_selections.py -> build/lib.linux-x86_64-2.7/h5py/tests/old
copying h5py/tests/old/test_attrs.py -> build/lib.linux-x86_64-2.7/h5py/tests/old
copying h5py/tests/old/test_h5p.py -> build/lib.linux-x86_64-2.7/h5py/tests/old
copying h5py/tests/old/test_h5t.py -> build/lib.linux-x86_64-2.7/h5py/tests/old
copying h5py/tests/old/test_group.py -> build/lib.linux-x86_64-2.7/h5py/tests/old
copying h5py/tests/old/test_file.py -> build/lib.linux-x86_64-2.7/h5py/tests/old
copying h5py/tests/old/test_h5f.py -> build/lib.linux-x86_64-2.7/h5py/tests/old
copying h5py/tests/old/common.py -> build/lib.linux-x86_64-2.7/h5py/tests/old
copying h5py/tests/old/test_objects.py -> build/lib.linux-x86_64-2.7/h5py/tests/old
copying h5py/tests/old/test_datatype.py -> build/lib.linux-x86_64-2.7/h5py/tests/old
copying h5py/tests/old/test_base.py -> build/lib.linux-x86_64-2.7/h5py/tests/old
copying h5py/tests/old/test_attrs_data.py -> build/lib.linux-x86_64-2.7/h5py/tests/old
creating build/lib.linux-x86_64-2.7/h5py/tests/hl
copying h5py/tests/hl/__init__.py -> build/lib.linux-x86_64-2.7/h5py/tests/hl
copying h5py/tests/hl/test_dataset_getitem.py -> build/lib.linux-x86_64-2.7/h5py/tests/hl
copying h5py/tests/hl/test_dims_dimensionproxy.py -> build/lib.linux-x86_64-2.7/h5py/tests/hl
copying h5py/tests/hl/test_file.py -> build/lib.linux-x86_64-2.7/h5py/tests/hl
running build_ext
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/h5py/build/h5py/setup.py", line 147, in <module>
cmdclass = CMDCLASS,
File "/usr/lib/python2.7/distutils/core.py", line 152, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "build/bdist.linux-x86_64/egg/setuptools/command/install.py", line 61, in run
File "/usr/lib/python2.7/distutils/command/install.py", line 601, in run
self.run_command('build')
File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/usr/lib/python2.7/distutils/command/build.py", line 128, in run
self.run_command(cmd_name)
File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "setup_build.py", line 99, in run
from Cython.Build import cythonize
ImportError: No module named Cython.Build
----------------------------------------
Cleaning up...
Command /tmp/h5py/bin/python -c "import setuptools, tokenize;__file__='/tmp/h5py/build/h5py/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-nyKOEl-record/install-record.txt --single-version-externally-managed --compile --install-headers /tmp/h5py/include/site/python2.7 failed with error code 1 in /tmp/h5py/build/h5py
Storing debug log for failure in /home/martijn/.pip/pip.log
martijn@hue:~$
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Reactions: 8
- Comments: 25 (4 by maintainers)
Commits related to this issue
- Fixed numpy and Cython dependencies Added numpy and Cython to setup_requires as recommended in https://github.com/numpy/numpy/issues/2434#issuecomment-65252402 and https://github.com/h5py/h5py/issues... — committed to jarthurgross/bloch_distribution by jarthurgross 9 years ago
- hoping tip from h5py/h5py#535 will help — committed to bmorris3/shampoo by bmorris3 8 years ago
- Pip install Cython before h5py See this bug regarding pip dependency ordering: https://github.com/h5py/h5py/issues/535 — committed to ChrisCummins/clgen by ChrisCummins 8 years ago
- added setup_requires Added setup_requires, like they describe in this general pip issue: https://github.com/h5py/h5py/issues/535#issuecomment-79158166 — committed to chriamue/libMR by chriamue 6 years ago
- Pip install Cython before h5py See this bug regarding pip dependency ordering: https://github.com/h5py/h5py/issues/535 [Exported from ffc86d3540cdee14e100d75d48db6c14e500e669] — committed to ChrisCummins/bazel_subtree_github_export by ChrisCummins 8 years ago
- Pip install Cython before h5py See this bug regarding pip dependency ordering: https://github.com/h5py/h5py/issues/535 [Exported from ffc86d3540cdee14e100d75d48db6c14e500e669] — committed to ChrisCummins/photolib by ChrisCummins 8 years ago
- Pip install Cython before h5py See this bug regarding pip dependency ordering: https://github.com/h5py/h5py/issues/535 [Exported from ffc86d3540cdee14e100d75d48db6c14e500e669] — committed to ChrisCummins/format by ChrisCummins 8 years ago
- Pip install Cython before h5py See this bug regarding pip dependency ordering: https://github.com/h5py/h5py/issues/535 [Exported from ffc86d3540cdee14e100d75d48db6c14e500e669] — committed to ChrisCummins/cldrive by ChrisCummins 8 years ago
- Pip install Cython before h5py See this bug regarding pip dependency ordering: https://github.com/h5py/h5py/issues/535 [Exported from ffc86d3540cdee14e100d75d48db6c14e500e669] — committed to ChrisCummins/cldrive by ChrisCummins 8 years ago
This is some ridiculous pip bug. In a clean virtualenv, if I do:
pip install --no-use-wheel --no-cache-dir h5pypip does the right thing and installs Cython first. However, if I do:
pip install --no-use-wheel --no-cache-dir Cython h5pythen pip does the wrong thing and tries to build h5py before installing Cython.
I worked around this by:
👍
Looks like pip is being a bit stupid here. If you try to install both
Cythonandh5pysimultaneously from e.g. arequirements.txtfile,Cythonwill not be available for buildingh5py, andh5pywill fail to install.If someone is having this issue even after trying all above suggestions, it may be because of difference in pip and python versions. If you are running python2, try: pip2 install Cython pip2 install h5py For python3, use pip3.