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

Can't install on Python 2.7 / 3.6+ #495

Closed
tysonite opened this issue Jan 21, 2020 · 10 comments
Closed

Can't install on Python 2.7 / 3.6+ #495

tysonite opened this issue Jan 21, 2020 · 10 comments
Assignees
Labels

Comments

@tysonite
Copy link

Steps to reproduce:

  1. Create virtual env.:
virtualenv -p python2.7 ~/test_env
  1. Try to install
$ pip install pytype
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting pytype
  Using cached pytype-2020.1.8.tar.gz (1.1 MB)
Collecting attrs
  Using cached attrs-19.3.0-py2.py3-none-any.whl (39 kB)
Processing /home/tysonite/.cache/pip/wheels/23/78/a9/42cd33ab2c683e45bdac8e313f311f7ad44f9590d521b3c2ff/importlab-0.5.1-py2.py3-none-any.whl
Collecting ninja
  Using cached ninja-1.9.0.post1.tar.gz (25 kB)
    ERROR: Command errored out with exit status 1:
     command: /home/tysonite/test_env/bin/python2.7 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-nRHVS5/ninja/setup.py'"'"'; __file__='"'"'/tmp/pip-install-nRHVS5/ninja/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-nRHVS5/ninja/pip-egg-info
         cwd: /tmp/pip-install-nRHVS5/ninja/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-nRHVS5/ninja/setup.py", line 7, in <module>
        from skbuild import setup
    ImportError: No module named skbuild
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
@tysonite
Copy link
Author

This looks to be related to pip 20.0.1 released recently as pip install pytype on pip 19.0.1 works fine.

@rchen152 rchen152 self-assigned this Jan 21, 2020
@rchen152 rchen152 added the bug label Jan 21, 2020
@rchen152
Copy link
Contributor

This isn't affecting just Python 2.7 - I can't install pytype in a 3.6 or 3.7 virtualenv either :(

Looking at https://github.com/pypa/pip/issues, pip 20.0+ seems to be experiencing some release pains, with multiple reports of missing dependencies. I'll keep an eye on this to see if it resolves by itself, or if it's a problem with pytype.

One thing that makes me a little nervous is scikit-build/ninja-python-distributions#27, which suggests the possibility that the ninja package we depend on is broken, instead of pip.

@tysonite tysonite changed the title Can't install on Python 2.7 Can't install on Python 2.7 / 3.6+ Jan 22, 2020
@rchen152
Copy link
Contributor

Digging into this a bit more, it appears to be pypa/pip#7636. The problem described in scikit-build/ninja-python-distributions#27 occurs when trying to install the source distribution for ninja, but pip should be installing one of the prebuilt wheels instead.

The only workaround I'm aware of is the suggestion by @tysonite to downgrade the pip version.

@tysonite
Copy link
Author

It looks like this has been solved by pypa/packaging#258. And once pip team updates their dependency via resolving pypa/pip#7626, this issue probably will be solved as well.

@rchen152
Copy link
Contributor

This appears to be fixed in pip 20.0.2.

@bsolomon1124
Copy link
Contributor

bsolomon1124 commented Feb 7, 2020

I believe there may still be an issue upstream with ninja; I get this same exact error in a GitLab CI/CD pipeline stage despite using pip 20.0.2.

pytype:
  stage: lint
  image: python:2.7-alpine
  before_script:
    - export PYTHONPATH="${PYTHONPATH}:/usr/lib/python2.7/site-packages"
    - python -m pip install --upgrade pip  # https://github.com/google/pytype/issues/501
    - python -m pip install pytype
  script:
    - pytype -V 2.7 -j "$(python2 -c 'import multiprocessing; print multiprocessing.cpu_count()')" . | tee pytype.txt
  artifacts:
    when: on_failure
    paths:
      - pytype.txt

Output:

Requirement already up-to-date: pip in /usr/local/lib/python2.7/site-packages (20.0.2)

...

Collecting pytype
  Downloading pytype-2020.2.6.tar.gz (1.1 MB)
Collecting attrs
  Downloading attrs-19.3.0-py2.py3-none-any.whl (39 kB)
Collecting importlab>=0.5.1
  Downloading importlab-0.5.1.tar.gz (19 kB)
Collecting ninja
  Downloading ninja-1.9.0.post1.tar.gz (25 kB)
    ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-bI9s85/ninja/setup.py'"'"'; __file__='"'"'/tmp/pip-install-bI9s85/ninja/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-bI9s85/ninja/pip-egg-info
         cwd: /tmp/pip-install-bI9s85/ninja/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-bI9s85/ninja/setup.py", line 7, in <module>
        from skbuild import setup
    ImportError: No module named skbuild
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Some other threads hint this might be alpine-linux specific (maybe?) but am having trouble dis-entangling things at the moment.

@rchen152
Copy link
Contributor

rchen152 commented Feb 7, 2020

@bsolomon1124 Have you ever successfully installed pytype in this environment? From what I can tell, the ninja source distribution does not install due to the missing skbuild import, but ninja tries to provide prebuilt wheels for all platforms.

@bsolomon1124
Copy link
Contributor

bsolomon1124 commented Feb 7, 2020

@rchen152

Have you ever successfully installed pytype in this environment?

Nope, sadly not 🤷‍♂ . (Working fine on RHEL 7 though.) Gave up today after fumbling around with different pip versions, VCS URLs, and the like. It does look to be because ninja fails to build on Alpine, and there are no working Alpine wheels that I can find.

@rchen152
Copy link
Contributor

rchen152 commented Feb 7, 2020

That's unfortunate; thanks for confirming.

@rbrtwng
Copy link

rbrtwng commented Jun 4, 2020

See the issue with Python 3.7 on Debian with pip 20.1.1. Solved by installing python3-dev.

sudo apt-get install python3-dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants