[sovled] Hi. I am trying to run `pants package` an...
# general
g
[sovled] Hi. I am trying to run
pants package
and get the following error:
The Pip requested was pip==23.0.1 but it does not work with the interpreter selected which is CPython 3.12.3 at /home/user/.pyenv/versions/3.12.3/bin/python3.12. Pip 23.0.1 requires Python <3.12,>=3.7.
. The target is
docker_image
. How can I set the interpreter for this build target?
1
(Python 3.12.2 is the default interpreter version)
Seems that the interpreter_constraints cannot be set on either the pants docker backend nor the docker_image target
I'd also be fine using a newer pip version that supports Py312, but this seems to be a pants internal hardcoded version (i've already set
pip_version=24.0
in
[python]
)
(pip 24.0 is supported by pex as required)
s
g
Thanks! I haven't overridden pex cli and I am using pants 2.20.0, so I should be fine according to the comment 🤔
s
the thing is dockerfile is parsed by a python script that also has a resolve, I bet it's using old pip
g
thanks for confirming, I had this in mind as well, but haven't found the resolve. I wonder, can I set Py312 in
python.resolves_to_interpreter_constraints
on resolve
dockerfile
? I will try...
you need to create a new resolve, install these requirements
Copy code
default_requirements = ["dockerfile>=3.2.0,<4"]
and set
install_from_resolve
https://www.pantsbuild.org/2.20/reference/subsystems/dockerfile-parser#install_from_resolve
1
g
That actually works! Thanks a ton 🙏
s
you're welcome 👍