Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to build wheel using python3.5, missing numpy dependency #4

Closed
velezj opened this issue Jan 15, 2019 · 4 comments
Closed

Unable to build wheel using python3.5, missing numpy dependency #4

velezj opened this issue Jan 15, 2019 · 4 comments

Comments

@velezj
Copy link

velezj commented Jan 15, 2019

To reproduce:

virtualenv --python=python3.5 .venv
.venv/bin/pip wheel gvar

Note: installation via pip install gvar works, it's the wheel building the fails.

Output:

Collecting gvar
  Using cached https://files.pythonhosted.org/packages/16/00/d8790d2a944e52b793c26299dd1ed3f5c7940aba58693dc75b2aa44b1d1f/gvar-9.0.3.tar.gz
Collecting numpy>=1.7 (from gvar)
  File was already downloaded /home/velezj/sandbox/vegas_bugreport/numpy-1.16.0-cp35-cp35m-manylinux1_x86_64.whl
Skipping numpy, due to already being wheel.
Building wheels for collected packages: gvar
  Running setup.py bdist_wheel for gvar ... error
  Complete output from command /home/velezj/sandbox/vegas_bugreport/.venv/bin/python3.5 -u -c "import setuptools, tokenize;__file__='/tmp/pip-wheel-6q168552/gvar/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-zbx13b8d:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.5
  creating build/lib.linux-x86_64-3.5/gvar
  copying src/gvar/linalg.py -> build/lib.linux-x86_64-3.5/gvar
  copying src/gvar/cspline.py -> build/lib.linux-x86_64-3.5/gvar
  copying src/gvar/ode.py -> build/lib.linux-x86_64-3.5/gvar
  copying src/gvar/root.py -> build/lib.linux-x86_64-3.5/gvar
  copying src/gvar/__init__.py -> build/lib.linux-x86_64-3.5/gvar
  copying src/gvar/powerseries.py -> build/lib.linux-x86_64-3.5/gvar
  copying src/gvar/../gvar.pxd -> build/lib.linux-x86_64-3.5/gvar/..
  copying src/gvar/_svec_smat.pxd -> build/lib.linux-x86_64-3.5/gvar
  copying src/gvar/_gvarcore.pxd -> build/lib.linux-x86_64-3.5/gvar
  running build_ext
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-wheel-6q168552/gvar/setup.py", line 113, in <module>
      'Topic :: Scientific/Engineering'
    File "/usr/local/lib/python3.5/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/usr/local/lib/python3.5/distutils/dist.py", line 955, in run_commands
      self.run_command(cmd)
    File "/usr/local/lib/python3.5/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/home/velezj/sandbox/vegas_bugreport/.venv/lib/python3.5/site-packages/wheel/bdist_wheel.py", line 188, in run
      self.run_command('build')
    File "/usr/local/lib/python3.5/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/local/lib/python3.5/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/usr/local/lib/python3.5/distutils/command/build.py", line 135, in run
      self.run_command(cmd_name)
    File "/usr/local/lib/python3.5/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/local/lib/python3.5/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/usr/local/lib/python3.5/distutils/command/build_ext.py", line 339, in run
      self.build_extensions()
    File "/tmp/pip-wheel-6q168552/gvar/setup.py", line 31, in build_extensions
      import numpy
  ImportError: No module named 'numpy'
  
  ----------------------------------------
  Failed building wheel for gvar
  Running setup.py clean for gvar
Failed to build gvar
ERROR: Failed to build one or more wheels
@gplepage
Copy link
Owner

The environment where you are building the wheel (.venv in your case?) needs to have numpy installed: setup.py has to be able to import numpy when it is run by pip. Is numpy installed for your example?

I have no trouble building a wheel in my setup but it would certainly fail if numpy wasn't installed. numpy is needed for the build because its header files are needed when compiling the cython files.

@velezj
Copy link
Author

velezj commented Jan 15, 2019 via email

@gplepage
Copy link
Owner

pip install gvar will automatically install numpy if it isn't there, as you say, but I don't know of any way to have this happen automatically when one is building a wheel. There is a setup option called setup_requires but this doesn't install things in the build environment (that's what the documentation says and I just tried it).

Having extra stuff installed in your environment when building a wheel might surprise and irritate people. You expect extra modules when installing something, but not so much when simply building a distribution. This could be why there is no way to make it automatic.

@gplepage
Copy link
Owner

I am closing this issue because I believe it is resolved (ie, you can build wheels so long as numpy is installed in the build environment). Thanks for pointing out the issue and documenting it here for future reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants