rapid-crayon-823203/02/2022, 5:51 PM
to generate c++ extensions using cmake and pybind11 for python, the build file I'm using right now:
But I get an error that it can't find
shell_sources(name="build-c-exts", sources=["./**/*"]) experimental_shell_command( name="c-deps", command="./build.sh", log_output=True, tools=["make", "cmake", "cat", "bash", "env", "chmod", "gcc", "g++", "as", "ld"], dependencies=[":build-c-exts"], outputs=["results/", "logs/my-script.log"], )
(I'm using pyenv), error in the thread ⬇️
.... In file included from /usr/include/pybind11/pytypes.h:12, from /usr/include/pybind11/cast.h:13, from /usr/include/pybind11/attr.h:13, from /usr/include/pybind11/pybind11.h:44, from /usr/include/pybind11/numpy.h:12, from /tmp/process-executionkJc7y1/src/lib/pybind11/farmwise_cv_utils.cpp:11: /usr/include/pybind11/detail/common.h:112:10: fatal error: Python.h: No such file or directory 112 | #include <Python.h> | ^~~~~~~~~~ compilation terminated. .....
hundreds-father-40403/02/2022, 5:57 PM
rapid-crayon-823203/02/2022, 6:00 PM
is missing from the system^^, adding it works Here the expected behavior I think is to use pyenv to find the python headers ?
hundreds-father-40403/02/2022, 6:02 PM
adding it worksAdding it how so? Installing via
for example? Adding to
rapid-crayon-823203/02/2022, 6:03 PM
hundreds-father-40403/02/2022, 6:05 PM
Here the expected behavior I think is to uses pyenv to find the python headers ?Perhaps Pants is using a different interpreter than what you use when running directly? Is your
doing the Python interpreter selection for you? (Altho does it even call Python directly?)
rapid-crayon-823203/02/2022, 6:07 PM
witty-crayon-2278603/02/2022, 9:21 PM
will be highly filtered in the script, so my guess is that a particular variable you’re expecting is not present
hundreds-father-40403/02/2022, 9:26 PM
in your terminal to see all your env vars. Then try running that same script directly w/o Pants where you set the env vars to empty values like
for example. Might be hard to reproduce now that you installed
rapid-crayon-823203/08/2022, 5:54 PM
if you determine that that is the problem, would you mind opening a Github issue about it?yes, it's definitely worth adding ^^, but I don't think it's the problem here It was simply that pants was using my
python instead of
since I defined both in the config. On a similar note, about the experimental_run_shell_command, does it support pass through args ? I'm trying to create a command that add a poetry dep and updates the constraints.txt file
and will be passed to the
./pants run poetry:add -- requests tqdm
script as classic sh arg vars
witty-crayon-2278603/08/2022, 6:23 PM
On a similar note, about the experimental_run_shell_command, does it support pass through args ?
I’m trying to create a command that add a poetry dep and updates the constraints.txt fileif it doesn’t, it should. lemme see.
goal always appends those arguments