markers 'platform_python_implementation == "cpython"' don't match your environment when installing gevent
See original GitHub issueWhen installing gevent using pipenv, greenlet is not being installed.
$ python -m pipenv.help output
Pipenv version: '11.10.1'
Pipenv location: '/usr/lib/python3.6/site-packages/pipenv'
Python location: '/usr/bin/python'
Other Python installations in PATH
:
-
2.7
:/usr/bin/python2.7
-
2.7
:/usr/bin/python2.7
-
2.7
:/home/jeremy/.pyenv/shims/python2.7
-
2.7
:/usr/bin/python2.7
-
3.6
:/usr/bin/python3.6m
-
3.6
:/usr/bin/python3.6
-
3.6
:/home/jeremy/.pyenv/shims/python3.6
-
3.6
:/usr/bin/python3.6
-
3.6.5
:/usr/bin/python
-
3.6.5
:/home/jeremy/.pyenv/shims/python
-
3.6.5
:/usr/bin/python
-
2.7.14
:/usr/bin/python2
-
2.7.14
:/home/jeremy/.pyenv/shims/python2
-
2.7.14
:/usr/bin/python2
-
3.6.5
:/usr/bin/python3
-
3.6.5
:/home/jeremy/.pyenv/shims/python3
-
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.16.5-1-ARCH',
'platform_system': 'Linux',
'platform_version': '#1 SMP PREEMPT Thu Apr 26 16:53:40 UTC 2018',
'python_full_version': '3.6.5',
'python_version': '3.6',
'sys_platform': 'linux'}
System environment variables:
LS_COLORS
LANG
LESS
FZF_DEFAULT_COMMAND
DISPLAY
PYENV_ROOT
OLDPWD
INVOCATION_ID
EDITOR
COLORTERM
PYENV_VIRTUALENV_INIT
MOZ_PLUGIN_PATH
PYENV_HOOK_PATH
XDG_VTNR
ZSH
SSH_AUTH_SOCK
FZF_CTRL_T_COMMAND
XDG_SESSION_ID
USER
PYENV_DIR
PAGER
LSCOLORS
PWD
HOME
LC_CTYPE
JOURNAL_STREAM
PYENV_VERSION
MAIL
VISUAL
WINDOWPATH
TERM
SHELL
VTE_VERSION
XDG_SEAT
SHLVL
PYENV_SHELL
WINDOWID
MAVEN_OPTS
LOGNAME
DBUS_SESSION_BUS_ADDRESS
XDG_RUNTIME_DIR
XAUTHORITY
PATH
PYTHONDONTWRITEBYTECODE
PIP_PYTHON_PATH
Pipenv–specific environment variables:
Debug–specific environment variables:
PATH
:/usr/bin:/home/jeremy/.pyenv/libexec:/home/jeremy/.pyenv/plugins/python-build/bin:/home/jeremy/.pyenv/plugins/pyenv-virtualenv/bin:/home/jeremy/.pyenv/plugins/pyenv-virtualenv/shims:/home/jeremy/.pyenv/shims:/home/jeremy/.pyenv/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/jeremy/bin:/home/jeremy/.gem/ruby/2.5.0/bin:/home/jeremy/.local/bin/:/home/jeremy/thirdrepos/google-cloud-sdk/bin
SHELL
:/usr/bin/zsh
EDITOR
:vim
LANG
:en_US.UTF-8
PWD
:/home/jeremy
Expected result
I expect installing gevent to also result in greenlet being installed.
Actual result
Instead of having greenlet installed, I get a warning about “Ignoring greenlet: markers ‘platform_python_implementation == “cpython”’ don’t match your environment”.
Steps to replicate
➜ ~/tmp/pipenving echo '[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
gevent = "*"
[dev-packages]
[requires]
python_version = "2.7"
[pipenv]
allow_prereleases = true' > Pipfile
➜ ~/tmp/pipenving pipenv install
Creating a virtualenv for this project…
Using /home/jeremy/.pyenv/versions/jfly-2.7.12/bin/python2.7 (2.7.12) to create virtualenv…
⠋Running virtualenv with interpreter /home/jeremy/.pyenv/versions/jfly-2.7.12/bin/python2.7
Using real prefix '/home/jeremy/.pyenv/versions/2.7.12'
New python executable in /home/jeremy/.local/share/virtualenvs/pipenving-IYbJmdaL/bin/python2.7
Also creating executable in /home/jeremy/.local/share/virtualenvs/pipenving-IYbJmdaL/bin/python
Installing setuptools, pip, wheel...done.
Virtualenv location: /home/jeremy/.local/share/virtualenvs/pipenving-IYbJmdaL
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Updated Pipfile.lock (6d8673)!
Installing dependencies from Pipfile.lock (6d8673)…
Ignoring greenlet: markers 'platform_python_implementation == "cpython"' don't match your environment
🐍 ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 2/2 — 00:00:00
To activate this project's virtualenv, run the following:
$ pipenv shell
➜ ~/tmp/pipenving pip freeze | grep gevent
You are using pip version 9.0.1, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
➜ ~/tmp/pipenving pipenv run pip freeze | grep greenlet
➜ ~/tmp/pipenving pipenv run pip freeze | grep gevent
gevent==1.3b1
Note the warning above about platform_python_implementation == “cpython” not matching my environment. I looked into this a bit, and according to PEP508, platform_python_implementation
corresponds to platform.python_implementation()
, which is equal to “CPython” for me:
➜ ~/tmp/pipenving pipenv run python -c "import platform; print platform.python_implementation()"
CPython
I verified that if I manually change the "markers": "platform_python_implementation == 'cpython'"
line in my Pipfile.lock from “cpython” to “CPython”, then pipenv install
works happily:
➜ ~/tmp/pipenving sed -i 's/cpython/CPython/' Pipfile.lock
➜ ~/tmp/pipenving pipenv install
Installing dependencies from Pipfile.lock (6d8673)…
🐍 ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 2/2 — 00:00:00
To activate this project's virtualenv, run the following:
$ pipenv shell
➜ ~/tmp/pipenving pipenv run pip freeze | grep greenlet
greenlet==0.4.13
However, this isn’t a permanent solution for me, as subsequent runs of pipenv lock
reset my Pipfile.lock to have a lowercase “cpython”:
➜ ~/tmp/pipenving pipenv lock
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Updated Pipfile.lock (6d8673)!
➜ ~/tmp/pipenving grep cpython Pipfile.lock
"markers": "platform_python_implementation == 'cpython'",
I confirmed that gevent 1.3b1 is correctly capitalizing “CPython” in its setup.py: https://github.com/gevent/gevent/blob/1.3b1/setup.py#L190, so I concluded that pipenv must be lowercasing this marker somewhere. I stepped through pipenv with a debugger to track down where the platform_python_implementation marker is getting lowercased, and I tracked it down to this line:
which invokes format_requirement
, which lowercases the entire requirement, including the markers:
It looks like the format_requirement
method was written with the intention of markers being specified as an optional second argument, so maybe the right fix is to change our invocation of format_requirement
to actually split off the markers and pass them in separately?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:19 (12 by maintainers)
Top GitHub Comments
I’ve sent in a PR here: https://github.com/pypa/pipenv/pull/2123.
Until we get this fixed, I am able to workaround this by adding the following line to our Pipfile:
(I got the idea for this hack from https://github.com/pypa/pipenv/issues/1757#issuecomment-373558866)
Track https://github.com/pypa/pipenv/projects/2 to find out! We still have a few pressing bugs need fixing.