pypa / pip

The Python package installer
https://pip.pypa.io/
MIT License
9.36k stars 2.98k forks source link

[24.1] Install from requirements.txt no longer works when using quotes #12789

Closed felix-bedag closed 6 days ago

felix-bedag commented 1 week ago

Description

Our requirements.txt file containes the following line:

connectorx>="0.3.2a8"

With pip 24.0 the command pip install -r path/to/requirements.txt was successful. With the version 24.1 however, we get the following error message:

ERROR: Invalid requirement: 'connectorx>="0.3.2a8"': Expected end or semicolon (after name and no valid version specifier)
connectorx>="0.3.2a8"
               ^ (from line 6 of /path/to/requirements.txt)

Removing the quotes fixed the issue.

Expected behavior

Installation succeeds even if package version name contains quotes.

pip version

24.1

Python version

3.10.12

OS

Ubuntu

How to Reproduce

Execute the following commands:

  1. pip install --force-reinstall -v "pip==24.1"
  2. echo 'connectorx>="0.3.2a8"' > requirements.txt
  3. pip install --force-reinstall -r requirements.txt

Now the error occurs.

Output

ERROR: Invalid requirement: 'connectorx>="0.3.2a8"': Expected end or semicolon (after name and no valid version specifier)
    connectorx>="0.3.2a8"
              ^ (from line 1 of requirements.txt)

Code of Conduct

uranusjr commented 6 days ago

Quotes were never a thing; its “support” never inteded. Remove them.

ichard26 commented 6 days ago

To follow up on this, pip 24.1 has removed support for legacy version and legacy version specifiers. Starting with pip 24.1, they all must conform to PEP 440. See https://pradyunsg.me/blog/2024/05/13/pip-24-1-betas/ for more information.

You should've received a deprecation warning at some point, at least with pip 24.0.