Hello, I have a problem with the plugins and how t...
# general
r
Hello, I have a problem with the plugins and how the dependencies to those are resolved. I have a plugin requiring a package that is available only for python3.9. Pants seems to run the pip command with python3.7, so pip tells me there is no package matching the requirements. I tried to add interpreter_contraints to differents places but I'm not able to make that work. How can I force pants to use python3.9 when resolving dependencies for pants plugins?
1
w
Pants runs itself using the Python version selected by the
pants
script: plugins will need to work with the version selected there
your interpreter constraints only come into play for your own code, or if your plugins have
BUILD
files which cause Pants to test them.
r
my plugin is in the same repo so it has a BUILD file. It also have its own requirements target with its own resolve
Is there any way to influence what version of python pants uses?
w
by editing the
pants
script
it also exposes a few environment variables
r
like changing the shebang?
w
the
pants
script is written in bash: the one in your repo probably looks like this: https://github.com/pantsbuild/setup/blob/gh-pages/pants
if you want to force a particular python version, you can see on line 30 in there that you can set
PYTHON=python3.9 ./pants
for example
or on line 162, you could edit
set_supported_poython_versions
: https://github.com/pantsbuild/setup/blob/gh-pages/pants#L162
r
I have my own script that ultimately pull the pex from github because of firewall and stuff
w
got it. then the PEX file is what is driving which interpreters are used.
r
So at the end of the day, I call the pants pex file. would it work if I call it with PYTHON=3.9?
w
PEX is a whole other story…. i’m actually not sure how to control which interpreter is used at runtime for a PEX (the constraints are baked in at build time)
r
ok then. It could be a bit problematic with plugins
w
r
PEX_PYTHON ?
w
looks like either:
Copy code
PEX_PYTHON
or
Copy code
PEX_PYTHON_PATH
r
ah, nice
I'll try that. thanks!
w
sure thing