bright-summer-97951
02/26/2024, 8:00 PMpants
configuration from python 3.10.*
to 3.12.*
.
Essentially, when I run either the fmt
or the lint
goals, pip==23.0.1
is used, which doesn't work with the new interpreter version (3.12.*
), causing an error to bubble up.
$ pants --print-stacktrace --no-pantsd --no-local-cache fmt ::
16:59:06.94 [INFO] Completed: Building docformatter.pex from <resource://pants.backend.python.lint.docformatter/docformatter.lock>
16:59:06.95 [ERROR] 1 Exception encountered:
Engine traceback:
in select
..
in pants.core.goals.fmt.fmt
`fmt` goal
Traceback (most recent call last):
File "/Users/erickrocha/Library/Caches/nce/0bb9722222f003de9629623179038ecab5b6bd747796b95272e1d271dba00578/bindings/venvs/2.19.0/lib/python3.9/site-packages/pants/core/goals/fmt.py", line 77, in fmt
return await _do_fix(
File "/Users/erickrocha/Library/Caches/nce/0bb9722222f003de9629623179038ecab5b6bd747796b95272e1d271dba00578/bindings/venvs/2.19.0/lib/python3.9/site-packages/pants/core/goals/fix.py", line 322, in _do_fix
all_results = await MultiGet(
File "/Users/erickrocha/Library/Caches/nce/0bb9722222f003de9629623179038ecab5b6bd747796b95272e1d271dba00578/bindings/venvs/2.19.0/lib/python3.9/site-packages/pants/engine/internals/selectors.py", line 374, in MultiGet
return await _MultiGet(tuple(__arg0))
File "/Users/erickrocha/Library/Caches/nce/0bb9722222f003de9629623179038ecab5b6bd747796b95272e1d271dba00578/bindings/venvs/2.19.0/lib/python3.9/site-packages/pants/engine/internals/selectors.py", line 172, in __await__
result = yield self.gets
pants.engine.process.ProcessExecutionFailure: Process 'Building docformatter.pex from <resource://pants.backend.python.lint.docformatter/docformatter.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.2 at /Users/erickrocha/.pyenv/versions/3.12.2/bin/python3.12. Pip 23.0.1 requires Python <3.12,>=3.7.
Use `--keep-sandboxes=on_failure` to preserve the process chroot for inspection.
What I think is the relevant portion of my lock-file
looks like this:
"path_mappings": {},
"pex_version": "2.1.148",
"pip_version": "23.2",
"prefer_older_binary": false,
"requirements": [
"PyJWT==2.8.0",
"SQLAlchemy==2.0.27",
"alembic==1.13.1",
"fastapi==0.109.2",
"psycopg2-binary==2.9.9",
"psycopg2==2.9.9",
"pydantic-settings==2.2.1",
"pydantic==2.6.1",
"uvicorn==0.27.1",
"workos==2.2.0"
],
"requires_python": [
"==3.12.*"
],
"resolver_version": "pip-2020-resolver",
"style": "universal",
"target_systems": [
"linux",
"mac"
],
"transitive": true,
"use_pep517": null
Note that the pip
version is set to 23.2
, which leads me to believe that the fmt
goal is either caching this information somewhere or that it doesn't retrieve that information from there at all.
I attempted to execute the command without cache and without the daemon as per the docs, but alas, to no avail. It's worth mentioning that I'm able to execute the run
goal without any issues.
Last, but not least, I'm fairly new to pants
and there's a lot to learn still, so apologies if I missed something obvious in the docs; I spent some time searching but didn't come across anything that helped me out.better-van-82973
02/26/2024, 9:59 PMhappy-kitchen-89482
02/26/2024, 11:03 PMhappy-kitchen-89482
02/26/2024, 11:04 PMhappy-kitchen-89482
02/26/2024, 11:04 PMbroad-processor-92400
02/26/2024, 11:47 PMbroad-processor-92400
02/26/2024, 11:49 PMbright-summer-97951
02/27/2024, 10:10 PMswift-dawn-80732
02/28/2024, 8:41 PMProcessExecutionFailure: Process 'Building ruff.pex from <resource://pants.backend.python.lint.ruff/ruff.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.2 at /Users/jperez/.pyenv/versions/3.12.2/bin/python3.12. Pip 23.0.1 requires Python <3.12,>=3.7.
curved-manchester-66006
02/28/2024, 8:44 PM<resource://pants.backend.python.lint.ruff/ruff.lock>'
(most/all? Pants lockfiles need to be updated)swift-dawn-80732
02/28/2024, 8:49 PMcurved-manchester-66006
02/28/2024, 8:52 PMpytest
example at https://www.pantsbuild.org/2.19/docs/python/overview/lockfiles#lockfiles-for-tools ?swift-dawn-80732
02/28/2024, 8:55 PM$ pants --print-stacktrace generate-lockfiles --resolve=ruff -ldebug
17:54:39.32 [ERROR] Invalid section [ruff] in /Users/jperez/demoda/repos/backend/pants.toml
17:54:39.32 [ERROR] Invalid config entries detected. See log for details on which entries to update or remove.
(Specify --no-verify-config to disable this check.)
Use --print-stacktrace for more error details and/or -ldebug for more logs.
See <https://www.pantsbuild.org/v2.19/docs/troubleshooting> for common issues.
Consider reaching out for help: <https://www.pantsbuild.org/v2.19/docs/getting-help>
swift-dawn-80732
02/28/2024, 8:56 PM--print-stacktrace
and -ldebug
made no differenceswift-dawn-80732
02/28/2024, 8:56 PM[python.resolves]
ruff = "3rdparty/python/ruff.lock"
[ruff]
install_from_resolve = "ruff"
requirements =["//3rdparty/python:ruff"]
curved-manchester-66006
02/28/2024, 9:00 PM17:54:39.32 [ERROR] Invalid section [ruff] in /Users/jperez/demoda/repos/backend/pants.toml
hmm, do you have pants.backend.experimental.python.lint.ruff
enabled?swift-dawn-80732
02/28/2024, 9:04 PMswift-dawn-80732
02/28/2024, 9:05 PMswift-dawn-80732
02/28/2024, 9:05 PMruff==0.2.2
swift-dawn-80732
02/28/2024, 9:05 PMpython_requirements(
name="ruff",
source="ruff-requirements.txt",
resolve="ruff",
)
curved-manchester-66006
02/28/2024, 9:16 PMpants generate-lockfiles --resolve=my-new-one
is an explicit user step, there isn't an implicit lockfile generate on first use
(FWIW I suspect the most common way to use tool resolves when not working around this issue is to roll everything into One Big Lockfile)swift-dawn-80732
02/28/2024, 9:20 PMcurved-manchester-66006
02/28/2024, 9:29 PMswift-dawn-80732
02/28/2024, 9:30 PMswift-dawn-80732
02/29/2024, 6:07 PM