rapid-crayon-8232
03/02/2022, 5:51 PMexperimental_shell_command
to generate c++ extensions using cmake and pybind11 for python, the build file I'm using right now:
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"],
)
But I get an error that it can't find Python.h
(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-404
03/02/2022, 5:57 PMpython3-dev
rapid-crayon-8232
03/02/2022, 6:00 PMpython3-dev
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-404
03/02/2022, 6:02 PMadding it worksAdding it how so? Installing via
apt-get
for example? Adding to tools=[]
?rapid-crayon-8232
03/02/2022, 6:03 PMhundreds-father-404
03/02/2022, 6:05 PMHere 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
build.sh
doing the Python interpreter selection for you? (Altho does it even call Python directly?)rapid-crayon-8232
03/02/2022, 6:07 PMwitty-crayon-22786
03/02/2022, 9:21 PMenv
and PATH
will be highly filtered in the script, so my guess is that a particular variable you’re expecting is not presenthundreds-father-404
03/02/2022, 9:26 PMenv
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 CPPFLAGS=''
for example.
Might be hard to reproduce now that you installed python3-dev
thorapid-crayon-8232
03/08/2022, 5:54 PMif 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
<PATH>
python instead of <PYENV>
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
./pants run poetry:add -- requests tqdm
and will be passed to the poetry/add.sh
script as classic sh arg varswitty-crayon-22786
03/08/2022, 6:23 PMOn 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.
run
goal always appends those arguments