-
Notifications
You must be signed in to change notification settings - Fork 150
Description
I just played a little with the test project you kindly provided. I am currently facing the challenge of adapting the setup.py file for my project turbodbc to reflect my recent move from Boost.Python to pyodbc11 (thanks for that as well).
This example here (as well as my project) features pybind11 in the install_requires section. This seems to be sufficient when installing from git with pip install /path/to/source.
Now consider the situation where I want to create a source distribution with python setup.py sdist for later upload to pypi. Subsequent installation with pip install python-example.0.0.1.tar.gz yields error messages (output edited for brevity):
Processing ./python_example/dist/python_example-0.0.1.tar.gz
Collecting pybind11>=1.7 (from python-example==0.0.1)
...
Building wheels for collected packages: python-example
Running setup.py bdist_wheel for python-example ... error
...
building 'python_example' extension
Traceback (most recent call last):
...
File "/tmp/pip-0aU382-build/setup.py", line 20, in __str__
import pybind11
ImportError: No module named pybind11
----------------------------------------
Failed building wheel for python-example
Running setup.py clean for python-example
Failed to build python-example
Installing collected packages: pybind11, python-example
Running setup.py install for python-example ... done
Successfully installed pybind11-1.8.1 python-example-0.0.1
Apparently, when building from a source distribution, pip install tries to build a wheel first. While building the wheel, the install requirements seem to be ignored. Even though this stage fails, pip install continues with a regular setup.py install afterwards that succeeds.
I have tried to resolve the issue by adding setup_requires=['pybind11>=1.7.0'] to setup.py. Indeed, the error message changes: Instead of a Python ImportError while building the wheel, I observe a compiler error instead, also while building the wheel:
src/main.cpp:1:31: fatal error: pybind11/pybind11.h: No such file or directory
compilation terminated.
error: command 'g++-5' failed with exit status 1
----------------------------------------
Failed building wheel for python-example
Again, the overall installation completes afterwards.
It would be great if you had some more ideas or advice. In the interest of a clean build output, I would otherwise consider packing the pybind header files (and License, of course) in my source distribution and remove the dependency to the pybind package.