Hey Pants folks! I'm having an interesting proble...
# general
s
Hey Pants folks! I'm having an interesting problem that I hope someone on here might be able to help me with. I'm using Pants for Python builds and recently I've been having an issue when I update a package version; I get the following error:
Copy code
ProcessExecutionFailure: Process 'Resolving constraints.txt' failed with exit code 1.
...
KeyError: "There is no item named 'Hypercorn-0.13.2.dist-info/METADATA' in the archive"
In that example, I went from
hypercorn
0.11.2 to 0.13.2. At first I was thinking this is just related to that particular library, but I've seen that issue happen with another:
stream-chat
. Other requirements seem to be updating fine and updating that package with pip directly seems to work. Has anyone else experienced this kind of issue and/or can point me in the right direction? Any help would be more appreciated! Thanks!
h
Hi! Sorry for the trouble. Can you post some surrounding log context, when running with
-ldebug
? You can also DM me if there is anything sensitive in there, or redact
Oh and also Pants version and what command you were running that exposes this?
s
Hey @happy-kitchen-89482, Thank you for the quick reply! (and I apologize from my slow one). We are running Pants version 2.6.0 and I have attached the output from around the error snippet I first posted. I'm not sure if this is helpful, but when I downloaded and unarchived the
whl
from pypi, the directory name it had was
hypercorn-0.13.2.dist-info
but the file that's been looked for (and throwing the error on) is
Hypercorn-0.13.2.dist-info/METADATA
(with the capital
H
in the name). This might be a red herring, but case mismatches seem to be a regular pest in my life 😄
e
Ok, thanks for the data. This is an old Pex bug. Repro at 2.1.42:
Copy code
$ pex --python python3.7 pex==2.1.42 -cpex -- Hypercorn==0.13.2 --disable-cache -- -c "import hypercorn; print(hypercorn.__file__)"
...
  File "/home/jsirois/.pex/installed_wheels/65c5c41e7bd725c6e82b3cd1a3d829ce48781cab/pex-2.1.42-py2.py3-none-any.whl/pex/dist_metadata.py", line 107, in _parse_wheel_package_info
    with whl.open(os.path.join(dist_info_dir, DistInfoDistribution.PKG_INFO)) as fp:
  File "/usr/lib/python3.7/zipfile.py", line 1503, in open
    zinfo = self.getinfo(name)
  File "/usr/lib/python3.7/zipfile.py", line 1431, in getinfo
    'There is no item named %r in the archive' % name)
KeyError: "There is no item named 'Hypercorn-0.13.2.dist-info/METADATA' in the archive"
Fixed at 2.1.43:
Copy code
$ pex --python python3.7 pex==2.1.43 -cpex -- Hypercorn==0.13.2 --disable-cache -- -c "import hypercorn; print(hypercorn.__file__)"
/tmp/tmpbsluw3ez/installed_wheels/054e74981a503fc0407a4d54dbe8a2e3722bae74/Hypercorn-0.13.2-py3-none-any.whl/hypercorn/__init__.py
That changelog is here: https://github.com/pantsbuild/pex/releases/tag/v2.1.43 And the fix was here: https://github.com/pantsbuild/pex/pull/1376 I'll drum up the magic to change the Pex version you're using here in a bit assuming you can't easily just upgrade Pants to 2.7x or newer.
@silly-diamond-59365 this addition to your
pants.toml
should do it:
Copy code
[download-pex-bin]
version = "v2.1.45"
known_versions.add = [
   "v2.1.45|darwin|8d7a267a9df7f9f81721b0100b8fe47bcd5821076981bebee207507a01bed9ae|3622149",
   "v2.1.45|linux|8d7a267a9df7f9f81721b0100b8fe47bcd5821076981bebee207507a01bed9ae|3622149"
]
🙌 1
That works here in the Pants 2.6.x branch if I add
Hypercorn==0.13.2
to Pants'
3rdparty/python/requirements.txt
and then
./pants repl 3rdparty/python:Hypercorn
.