Install Via pip Fails Due to Dependency scikit-build
AntumDeluge opened this issue · comments
Originally submitted here: ninja-build/ninja#1608
I believe that scikit-build
should be added as a dependency in pip install
as I get the following error if it is not installed:
$ pip install ninja
Collecting ninja
Using cached https://files.pythonhosted.org/packages/dd/96/e2ec4acccb8dee33b4987f553d531d61e3081c8d4cfbce249655dfe23906/ninja-1.9.0.post1.tar.gz
ERROR: Complete output from command python setup.py egg_info:
ERROR: Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-av7tfuja/ninja/setup.py", line 7, in <module>
from skbuild import setup
ModuleNotFoundError: No module named 'skbuild'
----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-av7tfuja/ninja/
Edit: System & platform information:
OS: Microsoft Windows 10 64-bit
Python & pip info:
$ python --version
Python 3.7.4
$ python -c 'import sys; print("64-bit: {}".format(sys.maxsize > 2**32))'
64-bit: True
$ pip --version
pip 19.1 from /usr/lib/python3.7/site-packages/pip (python 3.7)
$ pip search ninja
ninja (1.9.0.post1) - Ninja is a small build
system with a focus on
speed
...
since ninja binaries are expected to be available as wheel for all python distributions, it is not expected that we built it from source.
I think we should understand the root cause here.
Indeed, the wheels are expected to work with all python distributions. See https://pypi.org/project/ninja/#files
Using the python interpreter where there are issues, what is the output of the following:
from pip._internal.pep425tags import get_supported
print('\n'.join('-'.join(x) for x in get_supported()))
@jcfr I built a very simple testcase for you to reproduce the issue:
- Create a
Dockerfile
with the following content
FROM alpine:3.10
# install python3 (incl. pip3)
RUN apk add --no-cache --update python3
# add example file
RUN echo -e "from pip._internal.pep425tags import get_supported\nprint('\\\n'.join('-'.join(x) for x in get_supported()))" > /jcfr_test.py
RUN python3 /jcfr_test.py
# install ninja dependency manually
#RUN pip3 install 'scikit-build==0.10.0'
RUN pip3 install ninja
- Run
docker build --no-cache -t jcfr_test .
This results in
Step 4/5 : RUN python3 /jcfr_test.py
---> Running in 59175424ed96
cp37-cp37m-linux_x86_64
cp37-abi3-linux_x86_64
cp37-none-linux_x86_64
cp36-abi3-linux_x86_64
cp35-abi3-linux_x86_64
cp34-abi3-linux_x86_64
cp33-abi3-linux_x86_64
cp32-abi3-linux_x86_64
py3-none-linux_x86_64
cp37-none-any
cp3-none-any
py37-none-any
py3-none-any
py36-none-any
py35-none-any
py34-none-any
py33-none-any
py32-none-any
py31-none-any
py30-none-any
Removing intermediate container 59175424ed96
---> 5f0b70a8bc10
Step 5/5 : RUN pip3 install ninja
---> Running in 8124dbb4abb5
Collecting ninja
Downloading https://files.pythonhosted.org/packages/dd/96/e2ec4acccb8dee33b4987f553d531d61e3081c8d4cfbce249655dfe23906/ninja-1.9.0.post1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-c4xl435b/ninja/setup.py", line 7, in <module>
from skbuild import setup
ModuleNotFoundError: No module named 'skbuild'
Indeed, the wheels are expected to work with all python distributions.
Unfortunately not: pypa/pip#3969
Unfortunately (this word does come to mind repeatedly when thinking of Python packaging), requiring a build dependency can only be done by adding another file to the source tarball. Example: https://github.com/prody/ProDy/pull/806/files
But that should solve the problem for us alpine users 🙂
@andreparames can you please clarify what you mean by "that should solve the problem for us alpine users"? Which step are you suggesting solves that problem?
@bsolomon1124 you have to add a pyproject.toml
file to the root of the project (see example linked in my previous comment), with scikit-build
in the requires
line. That way, it'll fetch that dependency before building ninja.
Fixed in 1.10.0.post3