FS#70104 - [python-pip] 20.3.1 fails on installing packages with expected string or bytes-like object

Attached to Project: Arch Linux
Opened by Andrew (deathangel908) - Sunday, 21 March 2021, 10:45 GMT
Last edited by David Runge (dvzrv) - Wednesday, 29 June 2022, 10:06 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To David Runge (dvzrv)
Felix Yan (felixonmars)
Architecture x86_64
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description:
Installing packages from venv throws exception `expected string or bytes-like object`.


```
ERROR: Exception:
Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/pip/_internal/cli/base_command.py", line 224, in _main
status = self.run(options, args)
File "/usr/lib/python3.9/site-packages/pip/_internal/cli/req_command.py", line 180, in wrapper
return func(self, options, args)
File "/usr/lib/python3.9/site-packages/pip/_internal/commands/install.py", line 320, in run
requirement_set = resolver.resolve(
File "/usr/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 121, in resolve
self._result = resolver.resolve(
File "/usr/lib/python3.9/site-packages/resolvelib/resolvers.py", line 453, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
File "/usr/lib/python3.9/site-packages/resolvelib/resolvers.py", line 347, in resolve
failure_causes = self._attempt_to_pin_criterion(name, criterion)
File "/usr/lib/python3.9/site-packages/resolvelib/resolvers.py", line 216, in _attempt_to_pin_criterion
satisfied = all(
File "/usr/lib/python3.9/site-packages/resolvelib/resolvers.py", line 217, in <genexpr>
self._p.is_satisfied_by(r, candidate)
File "/usr/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/provider.py", line 95, in is_satisfied_by
return requirement.is_satisfied_by(candidate)
File "/usr/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/requirements.py", line 102, in is_satisfied_by
return spec.contains(candidate.version, prereleases=True)
File "/usr/lib/python3.9/site-packages/packaging/specifiers.py", line 790, in contains
item = parse(item)
File "/usr/lib/python3.9/site-packages/packaging/version.py", line 57, in parse
return Version(version)
File "/usr/lib/python3.9/site-packages/packaging/version.py", line 296, in __init__
match = self._regex.search(version)
TypeError: expected string or bytes-like object
```
Additional info:
* package version(s): 20.3.1-1 (works in 20.2.4-1)
* config and/or log files etc.
* link to upstream bug report, if any

Steps to reproduce:
1. create venv: `python3 -m venv --system-site-packages .venv`
2. Activate venv: `source .venv/bin/activate`
3. create requirements.txt with any dependency. E.g. `pyfcm==1.5.1`
4. Run `pip install -r requirements.txt`
This task depends upon

Closed by  David Runge (dvzrv)
Wednesday, 29 June 2022, 10:06 GMT
Reason for closing:  Works for me
Additional comments about closing:  python-pip 22.1.2-1 does not seem to be affected.
Comment by Eli Schwartz (eschwartz) - Sunday, 21 March 2021, 15:21 GMT
This works fine for me, both when I initialize the venv using --without-pip and when I let it bundle its own copy of ensurepip'ed pip.
Comment by Martin Molzer (WorldSEnder) - Monday, 31 May 2021, 15:26 GMT
Note the similarity to https://github.com/pypa/pip/issues/9348. Can you double check that there is no --user install of setuptools that interferes with the system-wide installation?
Comment by - (solnce) - Wednesday, 13 April 2022, 15:04 GMT
I just encountered the same bug. Reproducer here: https://github.com/asottile/importtime-waterfall/issues/67

N.B. I encounter this only in zsh, not in bash. (?!)
Comment by David Runge (dvzrv) - Wednesday, 29 June 2022, 10:06 GMT
@deathangel908: Thanks for the ticket.

I have tried all reproducers in this ticket with 22.1.2 (currently in [testing]) and have not run into any problems.
I will therefore close this ticket.

Loading...