I have `[python.pip_version]` set to `"23.1.2"` an...
# general
a
I have
[python.pip_version]
set to
"23.1.2"
and
[python.interpreter_constraints]
set to
['==3.12.0']
. When I run
pants generate-lockfiles --resolve=requirements
the
pip_version
in the file becomes
23.2
and when I attempt to package my project I get the following:
Copy code
ProcessExecutionFailure: Process 'Building dockerfile_parser.pex from <resource://pants.backend.docker.subsystems/dockerfile.lock>' failed with exit code 1.
stdout:

stderr:
The Pip requested was pip==23.0.1 but it does not work with the interpreter selected which is CPython 3.12.0 at ~/.pyenv/versions/3.12.0/bin/python3.12. Pip 23.0.1 requires Python <3.12,>=3.7.
Can anyone help me understand where I'm going wrong? Running Pants 2.19.
s
b
I think pip 23.2 is the first that supports python 3.12 fully (at least, for the things that PEX needs to use it for), so that explains the first (although silently setting it to a higher version is slightly surprising). For the second, the default lockfiles for Pants' built-in tools hadn't yet been adjusted that newer pip version. The patch fixing https://github.com/pantsbuild/pants/issues/20354 is in 2.21 (current dev releases). For now you can handle this by creating resolves for each tool you need + their requirements, e.g. some code something like
Copy code
# pants.toml
[python.resolve]
...
dockerfile_parser = "3rdparty/python/dockerfile_parser.lock"

[dockerfile-parser]
install_from_resolve = "dockerfile_parser"

# BUILD
python_requirement(name="dockerfile_parser", requirements=["dockerfile>=3.2.0,<4"], resolve="dockerfile_parser")
And so on for any other tools. It's a bit of a pain.
a
Ouch, that is a huge pain indeed. I think I'll just have to hold off upgrading until using 3.12 is slightly less cumbersome. One of my dependencies had a dependency on
pendulum < 3.0, python < 3.12
and
pendulum >= 3.0.0, python >= 3.12.0
. Since wheels aren't prebuilt for Pendulum 2 I was hoping to just upgrade the Python version in order to avoid building and publishing custom wheels. Thanks for the help both of you!
b
you can use pants 2.21.dev03 (or similar), i am not 100% sure. python 3.12 is working perfectly
👍 1