Hello. I'm back with my codegen plugin. I'm having...
# general
r
Hello. I'm back with my codegen plugin. I'm having an issue I don't understand. My plugin has a dependency on a wheel that requires python 3.9. Pants, when it starts, looks for python executables, picks one and runs with it. Unfortunately, it chooses python3.7 over python3.9, and when it tries to resolve the dependencies for my plugin, it fails, saying there is no way to resolve the dependencies for the wheel that requires python3.9. I tried to put interpreter_constraints=["CPython==3.9.*"] on the python_sources target on the BUILD file of my plugin and on the pants.toml/[python], same result. I tried to change the PATH to have the 3.9 version come first. With that, I can see that pants picks the 3.9 now. But then, pants continue to call pex from a venv under
~/.pex/venvs
that uses python3.7. I'm not sure what I should do to make pants understand it needs to choose python3.9 for my plugin 😕
w
What about something like this? https://www.pantsbuild.org/docs/options#pantsrc-file In
~/.pants.rc
Copy code
[python-bootstrap]
search_path = ["/usr/local/bin"]
r
well, it's a bit like changing the PATH isn't it? I'm not sure the path will be the same on all the machines pants will run.
I thing to note is that if I create and activate a python3.9 venv before running pants, then pex uses py3.9 and everything works
s/I/the
would
Copy code
[python-bootstrap]
name = ["python3.9"]
work maybe?
nope, doesn't work 😕
w
Really? Are you able to share your
pants.toml
? That's so strange. There are a few ways to specify the Pants runner
r
I can't right now. The thing is, pants seems to run with 3.9 but that's the calls to pex that seem to use the 3.7 version
I fixed my issue by setting
PEX_PYTHON=python3.9
:-)
👍 2