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

Pip=20.2 break packages installing on pypy #8653

Closed
dsp25no opened this issue Jul 29, 2020 · 8 comments
Closed

Pip=20.2 break packages installing on pypy #8653

dsp25no opened this issue Jul 29, 2020 · 8 comments
Labels
kind: crash For situations where pip crashes project: pypy PyPy specific Python 2 only Python 2 specific type: bug A confirmed bug or unintended behavior

Comments

@dsp25no
Copy link

dsp25no commented Jul 29, 2020

Environment

  • pip version: 20.2
  • Python version:
Python 2.7.13 (7.3.1+dfsg-2~ppa1~ubuntu16.04, Apr 23 2020, 03:08:28)                                                           
[PyPy 7.3.1 with GCC 5.4.0 20160609]
  • OS: tested on linux

Description
If you try to install any package with pip install, you will have follow stacktrace:

ERROR: Exception:
Traceback (most recent call last):
  File "/home/dsp25no/.pypyenv/site-packages/pip/_internal/cli/base_command.py", line 216, in _main
    status = self.run(options, args)
  File "/home/dsp25no/.pypyenv/site-packages/pip/_internal/cli/req_command.py", line 182, in wrapper
    return func(self, options, args)
  File "/home/dsp25no/.pypyenv/site-packages/pip/_internal/commands/install.py", line 421, in run
    pycompile=options.compile,
  File "/home/dsp25no/.pypyenv/site-packages/pip/_internal/req/__init__.py", line 90, in install_given_reqs
    pycompile=pycompile,
  File "/home/dsp25no/.pypyenv/site-packages/pip/_internal/req/req_install.py", line 831, in install
    requested=self.user_supplied,
  File "/home/dsp25no/.pypyenv/site-packages/pip/_internal/operations/install/wheel.py", line 829, in install_wheel
    requested=requested,
  File "/home/dsp25no/.pypyenv/site-packages/pip/_internal/operations/install/wheel.py", line 703, in _install_wheel
    assert os.path.exists(pyc_path)
AssertionError

Expected behavior
Success package installation with 0 return code.

How to Reproduce

  1. Install pypy
  2. Reproduce
pip wheel pip
virtualenv .pypyenv -p pypy
source .pypyenv/bin/activate
pypy pip-20.2-py2.py3-none-any.whl/pip install --force pip

More info
Regression happened in commit 2ece73c. compileall in Cpython generate compile files with names expected in function pyc_output_path, but with pypy filenames will be another, like __pycache__/__init__.pypy-73.pyc

@triage-new-issues triage-new-issues bot added the S: needs triage Issues/PRs that need to be triaged label Jul 29, 2020
@darklukee
Copy link

Same failures here:

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
pypy get-pip.py # FAILS
pypy get-pip.py "pip<20.2" #FAILS

@pradyunsg pradyunsg added kind: crash For situations where pip crashes project: pypy PyPy specific Python 2 only Python 2 specific type: bug A confirmed bug or unintended behavior labels Jul 30, 2020
@triage-new-issues triage-new-issues bot removed the S: needs triage Issues/PRs that need to be triaged label Jul 30, 2020
@pradyunsg
Copy link
Member

Thanks for filing a clear bug report @dsp25no!

Regression happened in commit 2ece73c

And thanks again for diagnosing the root cause! Much appreciated! ^>^


If I understand correctly, this only happens with Python 2.7 compatible version of PyPy. If that is not the case, please do provide an example/reproduction case for Python 3.

@dsp25no
Copy link
Author

dsp25no commented Jul 31, 2020

If I understand correctly, this only happens with Python 2.7 compatible version of PyPy. If that is not the case, please do provide an example/reproduction case for Python 3.

Yes, with Python 3 compatible version of PyPy new version of pip work fine.

@chrahunt
Copy link
Member

Is there a fully compatible mechanism to get the pyc file path that would be generated for a file? I see:

I checked with pypy2.7-7.3.1 (on Linux), but it doesn't look like either is backported.

PEP 3147 (introduced __pycache__) also mentions a mechanism for detecting whether PEP 3147 is available:

import imp
hasattr(imp, 'get_tag')

which returned False for me on the same version of pypy.

@heuer
Copy link

heuer commented Aug 12, 2020

It seems to be a Unix-only problem.
Just ran my test suite under Windows 10 Pro and it works (Python 2.7.13[pypy-7.3.0-final])
pip version: 20.2.1

@mattip
Copy link
Contributor

mattip commented Aug 25, 2020

I could not reproduce with the pypy I downloaded from https://downloads.python.org/pypy. Where did you get Python 2.7.13 (7.3.1+dfsg-2~ppa1~ubuntu16.04, Apr 23 2020, 03:08:28)?

@stefanor
Copy link
Contributor

stefanor commented Aug 25, 2020

pypy 2.7 on Debian and Ubuntu has PEP3147 implemented, to simplify the Debian package

Including imp.cache_from_source() and imp.get_tag()

>>>> imp.get_tag()
'pypy-73'

rfk added a commit to mozilla-services/tokenserver that referenced this issue Sep 2, 2020
Newer versions of `pip` do not work with `pypy` v2.7 on some
platforms, ref pypa/pip#8653
kevinoid added a commit to kevinoid/python-project-template that referenced this issue Oct 20, 2020
Work around https://bugs.debian.org/962654 by reinstalling pip in the
virutalenv before installing dependencies for pypy or pypy3.

Work around pypa/pip#8653 by using a version
of pip prior to 20.2 for pypy.

FIXME: This may reinstall pip 0 or more times depending on the package
dependencies (e.g. for pyproject.toml build requires, tox deps, package
deps).  No config option for post-create commands.  May need to create a
tox hook package to do this properly.

Signed-off-by: Kevin Locke <[email protected]>
@hexagonrecursion
Copy link
Contributor

This issue is marked as "python 2 only". pip 21.0 dropped support for Python 2. Should this be closed?

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind: crash For situations where pip crashes project: pypy PyPy specific Python 2 only Python 2 specific type: bug A confirmed bug or unintended behavior
Projects
None yet
Development

No branches or pull requests

9 participants