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

inconsistent behaviour between PIP_NO_BINARY and --no-binary #13077

Open
1 task done
alexlancaster opened this issue Nov 11, 2024 · 0 comments
Open
1 task done

inconsistent behaviour between PIP_NO_BINARY and --no-binary #13077

alexlancaster opened this issue Nov 11, 2024 · 0 comments
Labels
S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior

Comments

@alexlancaster
Copy link

alexlancaster commented Nov 11, 2024

Description

I am trying to use --only-binary together with --no-binary to force pip to use only binaries for all packages, except for one. It works fine when using both options on the command-line, but it does not work in the same way when using the environment variable version of the exact same options. This is needed in cibuildwheel, because environment variables are the only way to influence pip's behaviour (can't use the command-line directly).

Expected behavior

I would expect the behaviour to be identical when used in combination whether command line (--only-binary / --no-binary) or their environment variable equivalents (PIP_ONLY_BINARY / PIP_NO_BINARY) are used.

pip version

24.3.1

Python version

3.13

OS

Linux

How to Reproduce

  1. unset all environment variables to make sure we are always setting them explicitly:
     unset PIP_ONLY_BINARY
     unset PIP_NO_BINARY
    
  2. if docopt is installed, uninstall it:
    pip uninstall docopt
    
  3. purge cache:
    pip cache purge
    
  4. run:
    pip install --only-binary=:all: docopt
    
    should get the following (correct) output - the package should refuse to install because it is only distributed as .tar.gz:
    ERROR: Could not find a version that satisfies the requirement docopt (from versions: none)
    ERROR: No matching distribution found for docopt
    
  5. run the environment variable equivalent:
    PIP_ONLY_BINARY=:all: pip install  docopt
    
    this should also fail to install:
    ERROR: Could not find a version that satisfies the requirement docopt (from versions: none)
    ERROR: No matching distribution found for docopt
    
  6. so far, so good, now add --no-binary to allow docopt as an exception to the general rule:
    pip install --only-binary=:all: --no-binary=docopt docopt
    
    this allows docopt to install correctly:
    Collecting docopt
      Downloading docopt-0.6.2.tar.gz (25 kB)
      Installing build dependencies ... done
      Getting requirements to build wheel ... done
      Preparing metadata (pyproject.toml) ... done
    Building wheels for collected packages: docopt
      Building wheel for docopt (pyproject.toml) ... done
      Created wheel for docopt: filename=docopt-0.6.2-py2.py3-none-any.whl size=13707 sha256=466c7767b94bb0eb7ce11f401db4e92379c9ab2c0341e5bbb27e719f3c108b1d
      Stored in directory: /home/alex/.cache/pip/wheels/0b/1d/03/175286677fb5a1341cc3e4755bf8ec0ed08f3329afd67446b0
    Successfully built docopt
    Installing collected packages: docopt
    Successfully installed docopt-0.6.2
    
  7. uninstall docopt :
    pip uninstall docopt` 
    
    get:
    Found existing installation: docopt 0.6.2
    Uninstalling docopt-0.6.2:
      Would remove:
        /home/alex/.conda/envs/py313/lib/python3.13/site-packages/docopt-0.6.2.dist-info/*
       /home/alex/.conda/envs/py313/lib/python3.13/site-packages/docopt.py
    Proceed (Y/n)? y
      Successfully uninstalled docopt-0.6.2
    
  8. purge cache:
    pip cache purge
    
  9. try again, but using the environment variables:
    PIP_ONLY_BINARY=:all: PIP_NO_BINARY=docopt pip install docopt
    
    this (erroneously) fails, with output:
    ERROR: Could not find a version that satisfies the requirement docopt (from versions: none)
    ERROR: No matching distribution found for docopt
    
  10. This should be functionally identical to step 6, but it is not.

Output

output is shown inline, above.

Code of Conduct

@alexlancaster alexlancaster added S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior labels Nov 11, 2024
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

1 participant