Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pip install --find-links dist no longer prefers local over PyPI (fails maturin CI) #12110

Open
1 task done
chrisjsewell opened this issue Jun 27, 2023 · 3 comments
Open
1 task done
Labels
S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior

Comments

@chrisjsewell
Copy link

chrisjsewell commented Jun 27, 2023

Description

Since pip v20, if you have a package built locally and on PyPI at the same version,
the following command will prefer installing the PyPI package than the local build:

pip install mypkg --find-links dist --force-reinstall

If the local package has a newer version then that will be installed

This is a problem for e.g. maturin generate-ci github --pytest (PyO3/maturin#1680),
which builds the wheel (per OS), then installs and runs pytest.

It means that, for every PR, you have to ensure that you have bumped the version.

Expected behavior

Either the behaviour is reverted, or there is a separate flag to enforce the behaviour, e.g. --prefer-local

pip version

23.1.2

Python version

3.10

OS

Linux

How to Reproduce

  1. Upload a package to PyPI
  2. Build the package wheel locally, without changing the version, into a dist folder
  3. Run pip install mypkg --find-links dist --force-reinstall

Output

With pip-23.0.1

Looking in links: dist
Collecting markdown_it_pyrs
  Downloading markdown_it_pyrs-0.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 15.2 MB/s eta 0:00:00
Installing collected packages: markdown_it_pyrs

with pip-19.3.1

Processing ./dist/markdown_it_pyrs-0.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Installing collected packages: markdown-it-pyrs
Successfully installed markdown-it-pyrs-0.2.0

Code of Conduct

@chrisjsewell chrisjsewell added S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior labels Jun 27, 2023
@pfmoore
Copy link
Member

pfmoore commented Jun 27, 2023

Pp never preferred local over PyPI. It has always considered two copies of a package with the same name and version as being interchangeable. So unfortunately, without realising it, you have been relying on an accident of the current implementation (which appears to have changed).

If you want pip to prefer the local copy, you need to give it a higher version than the one on PyPI.

@baseplate-admin
Copy link

Hi, could we have a flag in pip that prefers local package instead of remote?

It's very test a pre release package in the CI/CD without this behavior of pip.

Thanks a bunch.

@pfmoore
Copy link
Member

pfmoore commented May 6, 2024

Hi, could we have a flag in pip that prefers local package instead of remote?

See #8224

In the meantime, uv provides an index strategy option which might do what you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior
Projects
None yet
Development

No branches or pull requests

3 participants