better-nail-12700
06/18/2020, 7:03 PMpython:3.7-buster
container. While building wheels gcc throws fatal error: Python.h: No such file or directory
. Python.h is indeed available under the following path: /usr/local/includes/python3.7m/
, however, from the gcc call that fails I can see that only /usr/includes/python3.7m/
is included. Any idea what the cause of this could be? Shouldn't it use the includes from the ~/.cache/pants/setup
directory anyway?better-nail-12700
06/18/2020, 7:04 PMhdbscan
package. Here is the corresponding call:
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python3.7m -I/tmp/pip-build-env-x1_hs1mx/overlay/lib/python3.7/site-packages/numpy/core/include -c hdbscan/_hdbscan_tree.c -o build/temp.linux-x86_64-3.7/hdbscan/_hdbscan_tree.o
hundreds-father-404
06/18/2020, 7:07 PMhundreds-father-404
06/18/2020, 7:09 PMinterpreter_search_paths
and/or interpreter_constraints
options: interpreter_search_paths
For example, with constraints, if you know the precise version of the interpreter you intend to use, you could set interpreter_constraints == ["==3.7.4"]
hundreds-father-404
06/18/2020, 7:09 PMhundreds-father-404
06/18/2020, 7:10 PMwhich -l python
? The above suggestion only helps if there are two Python 3.7 interpreters on your machine, and Pants is choosing the wrong one.better-nail-12700
06/18/2020, 7:14 PMwhich -a python
:
/usr/local/bin/python
/usr/local/bin/python
/usr/bin/python
The one located at /usr/bin/python
is Python 2.7.16, the other one is 3.7.7. I'm confused why it appears twice thoughhundreds-father-404
06/18/2020, 7:21 PMhundreds-father-404
06/18/2020, 7:27 PM/usr/local/bin/pip install hdbscan
?
(I want to double check that the install would work so that we can isolate if this issue is with Pants vs. the underlying Python installation)hundreds-father-404
06/18/2020, 7:27 PMsite-packages
. But it sounds like this is docker at least)witty-crayon-22786
06/18/2020, 7:30 PMwitty-crayon-22786
06/18/2020, 7:31 PM~/.cache/pants/setup
) is independent from what it will use to build your dependencies, which is controlled by the interpreter search path optionbetter-nail-12700
06/18/2020, 7:32 PM/usr/local/bin/pip install hdbscan
does indeed build the wheel without a problem 🤔witty-crayon-22786
06/18/2020, 7:33 PM-ldebug
which will dump “a lot” of information about what pex is doing with pipwitty-crayon-22786
06/18/2020, 7:34 PMbetter-nail-12700
06/18/2020, 7:34 PM/usr/bin/python3.7 /root/.cache/pants/named_caches/pex_root/pip.pex/240b20f98d345b70b316f7e734d4cea20bde73b6
) is called using /usr/bin/python3.7
witty-crayon-22786
06/18/2020, 7:34 PMpip
command rendered in the outputwitty-crayon-22786
06/18/2020, 7:34 PMhundreds-father-404
06/18/2020, 7:34 PMld_flags
and cpp_flags
, both in the [python-native-code]
options scope. They default to reading in the env varsecho $LDFLAGS
and echo $CPPFLAGS
do?witty-crayon-22786
06/18/2020, 7:34 PMbetter-nail-12700
06/18/2020, 7:34 PM/usr/bin/python3.7 /root/.cache/pants/named_caches/pex_root/pip.pex/240b20f98d345b70b316f7e734d4cea20bde73b6 --disable-pip-version-check --isolated --no-python-version-warning -q --cache-dir /root/.cache/pants/named_caches/pex_root wheel --no-deps --wheel-dir /root/.cache/pants/named_caches/pex_root/built_wheels/sdists/hdbscan-0.8.26.tar.gz/4e23f82a649125d3f93c58dbe9e0d190bf291947/cp37-cp37m.fd92366b7396429f905761e9ca34406c --index-url <https://pypi.org/simple/> --header Cache-Control:max-age=3600 --retries 5 --timeout 15 /tmp/tmpg5kitjbw/cp37-cp37m/hdbscan-0.8.26.tar.gz raised Executing /usr/bin/python3.7 /root/.cache/pants/named_caches/pex_root/pip.pex/240b20f98d345b70b316f7e734d4cea20bde73b6 --disable-pip-version-check --isolated --no-python-version-warning -q --cache-dir /root/.cache/pants/named_caches/pex_root wheel --no-deps --wheel-dir /root/.cache/pants/named_caches/pex_root/built_wheels/sdists/hdbscan-0.8.26.tar.gz/4e23f82a649125d3f93c58dbe9e0d190bf291947/cp37-cp37m.fd92366b7396429f905761e9ca34406c --index-url <https://pypi.org/simple/> --header Cache-Control:max-age=3600 --retries 5 --timeout 15 /tmp/tmpg5kitjbw/cp37-cp37m/hdbscan-0.8.26.tar.gz
witty-crayon-22786
06/18/2020, 7:35 PMwitty-crayon-22786
06/18/2020, 7:35 PMhundreds-father-404
06/18/2020, 7:36 PM/usr/bin/python3.7 --version
give you? Vs. /usr/local/bin/python3.7 --version
better-nail-12700
06/18/2020, 7:36 PMbetter-nail-12700
06/18/2020, 7:37 PMroot@14c340f404ce:/# /usr/bin/python3.7 --version
Python 3.7.3
root@14c340f404ce:/# /usr/local/bin/python3.7 --version
Python 3.7.7
better-nail-12700
06/18/2020, 7:37 PMhundreds-father-404
06/18/2020, 7:37 PM[python-setup]
interpreter_constraints = ["==3.7.7"]
hundreds-father-404
06/18/2020, 7:38 PM[python-setup]
interpreter_search_paths = ["/usr/local/bin"]
(You possibly would need to include more values in this than just /usr/local/bin
)better-nail-12700
06/18/2020, 7:40 PMbetter-nail-12700
06/18/2020, 7:44 PMbetter-nail-12700
06/18/2020, 7:47 PMinterpreter_constraints = ["==3.7.7"]That did the trick! 👍
hundreds-father-404
06/18/2020, 7:47 PM/usr/bin
one is installed by the OS. Those are hard to remove, and they’re usually out-of-date and also missing some key parts of a proper Python installation.
So, many containers install a more modern Python. Which results in two 🤷♂️hundreds-father-404
06/18/2020, 7:48 PMThat did the trick! 👍Yay! Is this an acceptable solution for your use case? Usually people don’t like putting something as specific
==3.7.7
in their config files because it risks things not working on other machines, e.g. if they have 3.7.8
installed. But if everyone is using the same docker image, then that’s irrelevanthappy-kitchen-89482
06/18/2020, 8:09 PMbetter-nail-12700
06/19/2020, 2:50 PM