acceptable-guitar-70265
06/11/2024, 12:00 PM2.21.0
and 2.22.0a0
The following changes fix the problem (i.e. lockfiles are generated as normal):
⢠set pants_version = "2.20.0"
in pants.toml
⢠configure the PyPI repo to not require authentication
As an MWE, I cloned the example-python repo, and added the following to `pants.toml`:
[python-repos]
indexes = [
"http://%(env.PYPI_USERNAME)s:%(env.PYPI_PASSWORD)s@%(env.PYPI_PATH)s",
]
I have verified that this works directly with pip
when passed via --index-url
(and --trusted-host
).
Running pants --keep-sandboxes=on_failure generate-lockfiles
fails with the following output:
12:50:02.79 [INFO] Initializing scheduler...
12:50:05.87 [INFO] Scheduler initialized.
12:50:10.98 [INFO] Preserving local process execution dir /tmp/pants-sandbox-bvPGIm for Generate lockfile for python-default
12:50:10.98 [INFO] Completed: Generate lockfile for python-default
12:50:10.98 [ERROR] 1 Exception encountered:
Engine traceback:
in `generate-lockfiles` goal
ProcessExecutionFailure: Process 'Generate lockfile for python-default' failed with exit code 1.
stdout:
stderr:
Pin(project_name=ProjectName(raw='py', validated=False, normalized='py'), version=Version(raw='1.11.0', normalized='1.11'))
If I add -vvv
to the pex command in the sandbox's __run.py
I get the additional traceback:
Traceback (most recent call last):exing downloads
File "/home/neil/.cache/pants/named_caches/pex_root/installed_wheels/8d43c1ed16877f3d2ed39e5ef3e92aa8885d4427cd7d9ce62683c922a5c0cd07/pex-2.3.1-py2.py3-none-any.whl/pex/result.py", line 105, in catch
return func(*args, **kwargs)
File "/home/neil/.cache/pants/named_caches/pex_root/installed_wheels/8d43c1ed16877f3d2ed39e5ef3e92aa8885d4427cd7d9ce62683c922a5c0cd07/pex-2.3.1-py2.py3-none-any.whl/pex/cli/command.py", line 110, in run
return subcommand_func(self)
File "/home/neil/.cache/pants/named_caches/pex_root/installed_wheels/8d43c1ed16877f3d2ed39e5ef3e92aa8885d4427cd7d9ce62683c922a5c0cd07/pex-2.3.1-py2.py3-none-any.whl/pex/cli/command.py", line 102, in _check_no_passthrough_args_and_run
return subcommand_func(self)
File "/home/neil/.cache/pants/named_caches/pex_root/installed_wheels/8d43c1ed16877f3d2ed39e5ef3e92aa8885d4427cd7d9ce62683c922a5c0cd07/pex-2.3.1-py2.py3-none-any.whl/pex/cli/commands/lock.py", line 851, in _create
create(
File "/home/neil/.cache/pants/named_caches/pex_root/installed_wheels/8d43c1ed16877f3d2ed39e5ef3e92aa8885d4427cd7d9ce62683c922a5c0cd07/pex-2.3.1-py2.py3-none-any.whl/pex/resolve/lockfile/create.py", line 428, in create
create_lock_download_manager = CreateLockDownloadManager.create(
File "/home/neil/.cache/pants/named_caches/pex_root/installed_wheels/8d43c1ed16877f3d2ed39e5ef3e92aa8885d4427cd7d9ce62683c922a5c0cd07/pex-2.3.1-py2.py3-none-any.whl/pex/resolve/lockfile/create.py", line 99, in create
artifact_and_project_name = source_artifacts_by_pin[pin]
KeyError: Pin(project_name=ProjectName(raw='py', validated=False, normalized='py'), version=Version(raw='1.11.0', normalized='1.11'))
Using --preserve-pip-download-log
in the pex command, it appears pip is able to access the authenticated repo no problem; the log file concludes with:
2024-06-11T12:56:52,578 Successfully downloaded ansicolors pytest setuptools types-setuptools attrs pluggy py tomli iniconfig packaging
I'd be grateful for any help debugging further šacceptable-guitar-70265
06/11/2024, 12:46 PMpants_version = "2.21.0"
to be run with the pex version that pants_version = "2.20.0"
uses (with the caveat that this is an unsupported combination)happy-kitchen-89482
06/11/2024, 1:57 PMacceptable-guitar-70265
06/11/2024, 2:03 PMacceptable-guitar-70265
06/11/2024, 2:03 PMhappy-kitchen-89482
06/11/2024, 2:38 PMhappy-kitchen-89482
06/11/2024, 2:38 PMhappy-kitchen-89482
06/11/2024, 2:38 PMhappy-kitchen-89482
06/11/2024, 2:44 PMhappy-kitchen-89482
06/11/2024, 2:45 PM__run.sh
) but with --version
instead of the args hardcoded via __run.sh
(or rather the script that thing runs - you'll have to do a tiny bit of spelunking)happy-kitchen-89482
06/11/2024, 2:47 PMacceptable-guitar-70265
06/11/2024, 2:53 PMBTW thanks for doing all the great debugging you mentioned!No problem - thanks for taking the time to help I'm taking a look at the steps you have suggested now
acceptable-guitar-70265
06/11/2024, 2:58 PMI want to double-check that you indeed forced Pants 2.21.0 to run with Pex v2.2.1 and the error happenedCan confirm this, yes -
--version
gives me 2.2.1
but did not happen with Pants 2.20.0 + Pex v2.2.1?Can also confirm this - forcing the pex version to remain the same and dropping the pants version down a minor level fixes the error
happy-kitchen-89482
06/11/2024, 3:27 PMhappy-kitchen-89482
06/11/2024, 3:27 PMhappy-kitchen-89482
06/11/2024, 3:27 PMhappy-kitchen-89482
06/11/2024, 3:27 PMacceptable-guitar-70265
06/11/2024, 3:41 PM--pip-version 23.1.2
and Pants 2.21.0 uses --pip-version 24.0
acceptable-guitar-70265
06/11/2024, 3:44 PMpython.pip_version = "23.1.2"
then everything works as expectedacceptable-guitar-70265
06/11/2024, 3:52 PMacceptable-guitar-70265
06/11/2024, 3:57 PMacceptable-guitar-70265
06/11/2024, 3:58 PMhappy-kitchen-89482
06/11/2024, 4:17 PM