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

Pipenv fails to honor environment markers, e.g. python_version #2584

Closed
MarkLodato opened this issue Jul 15, 2018 · 3 comments
Closed

Pipenv fails to honor environment markers, e.g. python_version #2584

MarkLodato opened this issue Jul 15, 2018 · 3 comments
Labels
Type: Duplicate This issue is a duplicate of an already-existing issue.

Comments

@MarkLodato
Copy link

Issue description

Pipenv does not honor environment markers in requirements.txt, or at least not python_version.

Example that is parsed incorrectly:

wsgiref==0.1.2;python_version<'3.0'
Expected result

wsgiref would be excluded from Pipfile because the Python version is 3 and requirements.txt said python_version<'3.0'.

Actual result

wsgiref is included in Pipfile.

Steps to replicate

Note: the same result is obtained whether or not --three is used and regardless of the whitespace in requirements.txt.

$ echo "wsgiref==0.1.2;python_version<'3.0'" > requirements.txt
$ pipenv install -r requirements.txt
Creating a virtualenv for this project...
Pipfile: /home/mark/tmp/pipenv-test/Pipfile
Using /usr/bin/python3 (3.6.5) to create virtualenv...
[... snip - see "Console output" below ...]
$ cat Pipfile
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
wsgiref = "==0.1.2"

[dev-packages]

[requires]
python_version = "3.6"
Console output of `pipenv install`

Since the output of this command is likely unhelpful, I made it hidden by default.

$ pipenv install -r requirements.txt
Creating a virtualenv for this project...
Pipfile: /home/mark/tmp/pipenv-test/Pipfile
Using /usr/bin/python3 (3.6.5) to create virtualenv...
⠋Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /home/mark/.local/share/virtualenvs/pipenv-test-qka95IxR/bin/python3
Also creating executable in /home/mark/.local/share/virtualenvs/pipenv-test-qka95IxR/bin/python
Installing setuptools, pip, wheel...done.
Setting project for pipenv-test-qka95IxR to /home/mark/tmp/pipenv-test

Virtualenv location: /home/mark/.local/share/virtualenvs/pipenv-test-qka95IxR
Creating a Pipfile for this project...
Requirements file provided! Importing into Pipfile...
Pipfile.lock not found, creating...
Locking [dev-packages] dependencies...
Locking [packages] dependencies...
py", line 337, in get_legacy_dependencies
    self.resolver.resolve(reqset)
  File "/home/mark/.local/lib/python3.6/site-packages/pipenv/patched/notpip/_internal/resolve.py", line 107, in resolve
    self._resolve_one(requirement_set, req)
  File "/home/mark/.local/lib/python3.6/site-packages/pipenv/patched/notpip/_internal/resolve.py", line 264, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "/home/mark/.local/lib/python3.6/site-packages/pipenv/patched/notpip/_internal/resolve.py", line 214, in _get_abstract_dist_for
    self.require_hashes
  File "/home/mark/.local/lib/python3.6/site-packages/pipenv/patched/notpip/_internal/operations/prepare.py", line 328, in prepare_linked_requirement
    abstract_dist.prep_for_dist(finder, self.build_isolation)
  File "/home/mark/.local/lib/python3.6/site-packages/pipenv/patched/notpip/_internal/operations/prepare.py", line 155, in prep_for_dist
    self.req.run_egg_info()
  File "/home/mark/.local/lib/python3.6/site-packages/pipenv/patched/notpip/_internal/req/req_install.py", line 486, in run_egg_info
    command_desc='python setup.py egg_info')
  File "/home/mark/.local/lib/python3.6/site-packages/pipenv/patched/notpip/_internal/utils/misc.py", line 698, in call_subprocess
    % (command_desc, proc.returncode, cwd))
pipenv.patched.notpip._internal.exceptions.InstallationError: Command "python setup.py egg_info" failed with error code 1 in /tmp/tmpoizlzhhxbuild/wsgiref/

Note: The bad error message is due to #2329.


$ pipenv --support

Pipenv version: '2018.7.1'

Pipenv location: '/home/mark/.local/lib/python3.6/site-packages/pipenv'

Python location: '/usr/bin/python3'

Other Python installations in PATH:

  • 3.6: /usr/bin/python3.6m

  • 3.6: /usr/bin/python3.6

  • 3.6.5: /usr/bin/python3

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.6.5',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '4.4.0-17134-Microsoft',
 'platform_system': 'Linux',
 'platform_version': '#137-Microsoft Thu Jun 14 18:46:00 PST 2018',
 'python_full_version': '3.6.5',
 'python_version': '3.6',
 'sys_platform': 'linux'}

System environment variables:

  • HOSTTYPE
  • _
  • LANG
  • USER
  • PWD
  • HOME
  • NAME
  • TERM
  • SHELL
  • SHLVL
  • LOGNAME
  • PATH
  • OLDPWD
  • LESS
  • LS_COLORS
  • PYTHONDONTWRITEBYTECODE
  • PIP_PYTHON_PATH

Pipenv–specific environment variables:

Debug–specific environment variables:

  • PATH: /home/mark/local/bin:/home/mark/p/scripts:/home/mark/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Windows/System32:/mnt/c/Windows:/mnt/c/Windows/System32/wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0:/mnt/c/Program Files/Intel/WiFi/bin:/mnt/c/Program Files/Common Files/Intel/WirelessCommon:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/Windows/System32:/mnt/c/Windows:/mnt/c/Windows/System32/wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0:/mnt/c/Windows/System32/OpenSSH:/mnt/c/ProgramData/chocolatey/bin:/mnt/c/Program Files (x86)/vim/vim80:/mnt/c/Users/lodat/AppData/Local/Microsoft/WindowsApps:/mnt/c/Program Files/Oracle/VirtualBox
  • SHELL: /bin/bash
  • LANG: en_US.UTF-8
  • PWD: /home/mark/tmp/pipenv-test

Contents of Pipfile ('/home/mark/tmp/pipenv-test/Pipfile'):

[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
wsgiref = "==0.1.2"

[dev-packages]

[requires]
python_version = "3.6"
@MarkLodato
Copy link
Author

Supposedly this was fixed in #848 but evidently not, or else I'm misunderstanding #848.

@techalchemy
Copy link
Member

Sorry you encountered this. This is a duplicate of #2359 and was already resolved in #2384 (not yet released, but merged into master)

Feel free to test that out and let us know if it isn't working. For the record, if your issue is number 2584, and you think something was incorrectly closed almost 2000 issues ago, but that nobody pointed it out in between, you probably are just missing a few intervening issues :p

@techalchemy techalchemy added the Type: Duplicate This issue is a duplicate of an already-existing issue. label Jul 15, 2018
@MarkLodato
Copy link
Author

Ah, I searched for "environment markers" but #2359 didn't use that term. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Duplicate This issue is a duplicate of an already-existing issue.
Projects
None yet
Development

No branches or pull requests

2 participants