pipenv: markers 'platform_python_implementation == "cpython"' don't match your environment when installing gevent
When 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?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 4
- Comments: 19 (12 by maintainers)
Commits related to this issue
- When formatting a requirement, only lowercase its name. This fixes https://github.com/pypa/pipenv/issues/2113. This bug was introduced in <https://github.com/jazzband/pip-tools/pull/452> as a band-a... — committed to jfly/pipenv by jfly 6 years ago
- When formatting a requirement, only lowercase its name. This fixes https://github.com/pypa/pipenv/issues/2113. This bug was introduced in <https://github.com/jazzband/pip-tools/pull/452> as a band-a... — committed to jfly/pipenv by jfly 6 years ago
- chore: add greenlet marker Workaround for: https://github.com/pypa/pipenv/issues/2113 — committed to DD-DeCaF/iam by kvikshaug 6 years ago
- When formatting a requirement, only lowercase its name. This fixes https://github.com/pypa/pipenv/issues/2113. This bug was introduced in <https://github.com/jazzband/pip-tools/pull/452> as a band-a... — committed to jfly/pipenv by jfly 6 years ago
- When formatting a requirement, only lowercase its name. This fixes https://github.com/pypa/pipenv/issues/2113. This bug was introduced in <https://github.com/jazzband/pip-tools/pull/452> as a band-a... — committed to jfly/pipenv by jfly 6 years ago
- When formatting a requirement, only lowercase its name. This fixes https://github.com/pypa/pipenv/issues/2113. This bug was introduced in <https://github.com/jazzband/pip-tools/pull/452> as a band-a... — committed to jfly/pipenv by jfly 6 years ago
- Hack Hacked Pipfile.lock to fix: https://github.com/pypa/pipenv/issues/2113 — committed to UMDLARS/tron by derpferd 6 years ago
- Workaround for https://github.com/pypa/pipenv/issues/2113 — committed to ONSdigital/eq-survey-runner by kierenbeckett 6 years ago
- Workaround for https://github.com/pypa/pipenv/issues/2113 — committed to ONSdigital/eq-survey-runner by kierenbeckett 6 years ago
- Workaround for https://github.com/pypa/pipenv/issues/2113 — committed to ONSdigital/eq-survey-runner by kierenbeckett 6 years ago
- Workaround for https://github.com/pypa/pipenv/issues/2113 — committed to ONSdigital/eq-survey-runner by kierenbeckett 6 years ago
- Workaround for https://github.com/pypa/pipenv/issues/2113 — committed to ONSdigital/eq-survey-runner by kierenbeckett 6 years ago
- Workaround for https://github.com/pypa/pipenv/issues/2113 — committed to ONSdigital/eq-survey-runner by kierenbeckett 6 years ago
- Introduce workaround for pypa/pipenv#2113 Currently we can't cf push if we update greenlets. This will force the right platform to be used. — committed to ONSdigital/ras-party by PurpleBooth 6 years ago
- Zipkin and pypa/pipenv#2113 (#165) * Revert "Revert "Zipkin flask (#161)" (#164)" This reverts commit 65422ec3c24298cd7f26bc638e3e8480e4c7eff9. * Introduce workaround for pypa/pipenv#2113 Cu... — committed to ONSdigital/ras-party by PurpleBooth 6 years ago
- Add pypa/pipenv#2113 workaround Currently the build is failing after an update to gevent. This will specify the platform and fix the build. — committed to ONSdigital/ras-collection-instrument by PurpleBooth 6 years ago
- Zipkin + pypa/pipenv#2113 fix (#130) * Revert "Revert "ZipKin Tracing (#126)" (#129)" This reverts commit 6304a003055feac839ac6efcea8f1c0737d31fec. * Add pypa/pipenv#2113 workaround Currentl... — committed to ONSdigital/ras-collection-instrument by PurpleBooth 6 years ago
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.
Depending on the ongoing merges etc going smoothly it should be in the next day or two