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

No matching distribution found when same package is listed with different environment markers #6084

Open
AndreyMZ opened this issue Dec 15, 2018 · 1 comment
Labels
C: requirement file Using `requirements.txt` state: needs discussion This needs some more discussion

Comments

@AndreyMZ
Copy link

Environment

  • pip version: 18.1
  • Python version: 3.7.1
  • OS: Debian GNU/Linux 9 (stretch)

Details: https://github.com/docker-library/python/blob/39c500cc8aefcb67a76d518d789441ef85fc771f/3.7/stretch/Dockerfile

Description

pip does not properly work when the same package is listed in a requirements file multiple times with different environment markers.

How to Reproduce

  1. Create file requirements.txt:

     mysqlclient ; sys_platform == 'linux'
     mysqlclient ; sys_platform == 'win32' --only-binary=mysqlclient
    
  2. Create file Dockerfile:

     FROM python
     COPY ./requirements.txt ./
     RUN pip install -r requirements.txt
    
  3. Build docker image:

     docker build .
    

Output (actual behaviour)

C:\bug>docker build .
...
Step 3/3 : RUN pip install -r requirements.txt
 ---> Running in 8f67f72f26d0
Ignoring mysqlclient: markers 'sys_platform == "win32"' don't match your environment
Collecting mysqlclient (from -r requirements.txt (line 1))
  Could not find a version that satisfies the requirement mysqlclient (from -r requirements.txt (line 1)) (from versions: )
No matching distribution found for mysqlclient (from -r requirements.txt (line 1))
The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1

Expected behavior

Package mysqlclient is successfully installed.

@pradyunsg pradyunsg added the S: needs triage Issues/PRs that need to be triaged label Jan 20, 2019
@chrahunt
Copy link
Member

The cause appears to be here, where we accumulate options that may be specified multiple times from the requirements.

This is probably also related to #5795.

@chrahunt chrahunt added C: requirement file Using `requirements.txt` state: needs discussion This needs some more discussion labels Jul 26, 2019
@triage-new-issues triage-new-issues bot removed the S: needs triage Issues/PRs that need to be triaged label Jul 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: requirement file Using `requirements.txt` state: needs discussion This needs some more discussion
Projects
None yet
Development

No branches or pull requests

3 participants