question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incompatibility with pypy3

See original GitHub issue

Issue description

Recent versions of pipenv no longer work with pypy3.

Expected result

Expected pipenv to work.

Actual result

❯ PYENV_VERSION=pypy3.5-6.0.0 pyenv exec pipenv --verbose
Traceback (most recent call last):
  File "/Users/ob/.pyenv/versions/pypy3.5-6.0.0/bin/pipenv", line 7, in <module>
    from pipenv import cli
  File "/Users/ob/.pyenv/versions/pypy3.5-6.0.0/site-packages/pipenv/__init__.py", line 47, in <module>
    from .cli import cli
  File "/Users/ob/.pyenv/versions/pypy3.5-6.0.0/site-packages/pipenv/cli/__init__.py", line 3, in <module>
    from .command import cli
  File "/Users/ob/.pyenv/versions/pypy3.5-6.0.0/site-packages/pipenv/cli/command.py", line 19, in <module>
    from .options import (
  File "/Users/ob/.pyenv/versions/pypy3.5-6.0.0/site-packages/pipenv/cli/options.py", line 11, in <module>
    from .. import environments
  File "/Users/ob/.pyenv/versions/pypy3.5-6.0.0/site-packages/pipenv/environments.py", line 7, in <module>
    from ._compat import fix_utf8
  File "/Users/ob/.pyenv/versions/pypy3.5-6.0.0/site-packages/pipenv/_compat.py", line 98, in <module>
    OUT_ENCODING, ERR_ENCODING = force_encoding()
  File "/Users/ob/.pyenv/versions/pypy3.5-6.0.0/site-packages/pipenv/_compat.py", line 68, in force_encoding
    from ctypes import pythonapi, py_object, c_char_p
ImportError: cannot import name 'pythonapi'

Steps to replicate

Simply install pipenv with PyPy3, then try to run any pipenv command.


pipenv --support won’t work either.

PyPy doesn’t support ctypes.pythonapi, but the root cause of the issue is that it shouldn’t even try to import this module in the first place. I’ve investigated a bit and it looks with PyPy3, sys.stdout.encoding returns "utf8" instead of "utf-8". I’m unsure whether this is a PyPy bug or not, but since pipenv used to work fine with PyPy3 prior to (I think) #3096, can we relax the condition on this line to allow for "utf8" as well as "utf-8"?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:5
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
frostmingcommented, Nov 28, 2018

Pipenv is not guaranteed to work on PyPy, nor is PyPy included in our CI setup.

Well, PyPy appears in setup.py classifiers? That should be removed, sorry for the trouble.

3reactions
ob-stripecommented, Nov 28, 2018
Read more comments on GitHub >

github_iconTop Results From Across the Web

Python compatibility - PyPy
Python compatibility. The goal of this page is to point out some of the differences between running python with PyPy and with CPython ......
Read more >
Cannot import numpy in pypy3 (installs fine with pip)
numpy 1.16.0 is incompatible with pypy3 v6.0, more details here. The solution is to use either numpy 1.15.4, or to use a pypy3...
Read more >
Binary incompatibility with Kivy and Pypy 3.7.5 - Google Groups
[INFO ] [Kivy ] Installed at "/home/qube/pypy3.7-v7.3.5-linux64/site-packages/kivy/__init__.py". [INFO ] [Python ] v3.7.10 (77787b8f4c49, ...
Read more >
tp_itemsize == 1 for str in PyPy3 (#3772) - PyPy - GitLab
It'd just prevent Cython cdef classes from inheriting from str/unicode on PyPy3, which probably isn't a huge incompatibility.
Read more >
Removing pypy3 from unit tests due to pip incompatibility ... - OpenDev
deb-python-cassandra-driver - RETIRED, further work has moved to Debian project infrastructure.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found