quaint-telephone-89068
10/23/2025, 3:01 PMpants run, pants package, etc. fail to run.
Pants version
2.29.0
OS
MacOS and Linux, or both
Additional info
Minimal setup to reproduce. We add black as a top-level dependency and override the version of its transitive dependency, `click`:
pants.toml
[GLOBAL]
pants_version = "2.29.0"
backend_packages = ["pants.backend.python"]
[python]
interpreter_constraints = ["==3.12.*"]
enable_resolves = true
default_resolve = "python-default"
[python.resolves]
python-default = "python-default.lockfile"
[python.resolves_to_overrides]
python-default = [
"click==7.1", # A transitive dependency of `black`: click>=8.0.0
]
main.py
import black # Do not remove this import
if __name__ == '__main__':
print('Hello, World!')
BUILD
python_sources()
python_requirement(
name="requirements",
requirements=["black"],
)
---
Generating the lockfile works fine, the correct overridden click==7.1 is picked up:
❯ pants generate-lockfiles --resolve=python-default
17:54:30.67 [INFO] Initializing scheduler...
17:54:30.96 [INFO] Scheduler initialized.
17:54:34.10 [INFO] Completed: Scheduling: Find interpreter for constraints: CPython==3.12.*
17:54:39.34 [INFO] Completed: Generate lockfile for python-default
17:54:39.34 [INFO] Completed: Scheduling: Generate lockfile for python-default
17:54:39.36 [INFO] Wrote lockfile for the resolve `python-default` to python-default.lockfile
Lockfile diff: python-default.lockfile [python-default]
== Added dependencies ==
black 25.9.0
click 7.1
mypy-extensions 1.1.0
packaging 25.0
pathspec 0.12.1
platformdirs 4.5.0
pytokens 0.2.0
However, trying to run the code fails:
❯ pants run main.py
17:55:50.74 [INFO] Completed: Scheduling: Building local_dists.pex
17:55:50.78 [INFO] Completed: Scheduling: Test binary /bin/bash.
17:55:52.75 [INFO] Completed: Building 1 requirement for .pex from the python-default.lockfile resolve: black
17:55:52.75 [INFO] Completed: Scheduling: Building 1 requirement for .pex from the python-default.lockfile resolve: black
17:55:52.75 [ERROR] 1 Exception encountered:
Engine traceback:
in `run` goal
ProcessExecutionFailure: Process 'Building 1 requirement for .pex from the python-default.lockfile resolve: black' failed with exit code 1.
stdout:
stderr:
The --override option cannot be used when resolving against a lock file. Only overrides already present in the lock file will be applied.
Examining the command being run shows a pex call with ... --lock python-default.lockfile ... $'--override=click==7.1' ...
pantsbuild/pantsquaint-telephone-89068
10/23/2025, 5:59 PM