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

v45 is still set to build a universal wheel, but doesn't support Python 2 #1976

Closed
bennuttall opened this issue Jan 19, 2020 · 3 comments · Fixed by #1978
Closed

v45 is still set to build a universal wheel, but doesn't support Python 2 #1976

bennuttall opened this issue Jan 19, 2020 · 3 comments · Fixed by #1978

Comments

@bennuttall
Copy link
Contributor

If you run

pip3 wheel setuptools --no-binary :all:

this yields the file setuptools-45.0.0-py2.py3-none-any.whl

but if you try to use it with Python 2, it fails with the error

setuptools requires Python '>=3.5' but the running Python is 2.7.17

This arose in my piwheels project. We build wheels of everything on PyPI on Raspberry Pi hardware. Some users have reported their Python 2 projects suffering for this. See piwheels/packages#74. We don't build for Python 2 (we never have) and generally, pure Python wheels get built with a py3 Python version tag. Only when a project specifies "universal" in their setup do we end up with a py2.py3 tag.

Example: if I have /etc/pip.conf configured to use piwheels.org as an additional index, then trying to create a Python 2 virtualenv fails:

ben@gunter:~ $ cat /etc/pip.conf 
[global]
extra-index-url=https://www.piwheels.org/simple
ben@gunter:~ $ mkvirtualenv py2
Running virtualenv with interpreter /usr/bin/python2
New python executable in /home/ben/.virtualenvs/py2/bin/python2
Also creating executable in /home/ben/.virtualenvs/py2/bin/python
Installing setuptools, pkg_resources, pip, wheel...
  Complete output from command /home/ben/.virtualenvs/py2/bin/python2 - setuptools pkg_resources pip wheel:
  Collecting setuptools
  Downloading https://www.piwheels.org/simple/setuptools/setuptools-45.0.0-py2.py3-none-any.whl (583kB)
setuptools requires Python '>=3.5' but the running Python is 2.7.17
----------------------------------------
...Installing setuptools, pkg_resources, pip, wheel...done.
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/virtualenv.py", line 2375, in <module>
    main()
  File "/usr/lib/python3/dist-packages/virtualenv.py", line 724, in main
    symlink=options.symlink)
  File "/usr/lib/python3/dist-packages/virtualenv.py", line 992, in create_environment
    download=download,
  File "/usr/lib/python3/dist-packages/virtualenv.py", line 922, in install_wheel
    call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
  File "/usr/lib/python3/dist-packages/virtualenv.py", line 817, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command /home/ben/.virtualenvs/py2/bin/python2 - setuptools pkg_resources pip wheel failed with error code 1

setuptools still has universal = 1 in setup.cfg

I guess this should either be set to 0 or that section removed. I'll open a PR.

@jaraco
Copy link
Member

jaraco commented Jan 19, 2020

I believe this is a dupe of #1974.

@jaraco jaraco closed this as completed Jan 19, 2020
jaraco added a commit that referenced this issue Jan 19, 2020
Ensure bdist_wheel no longer creates a universal wheel [remove bdist_wheel block], close #1976
@pganssle
Copy link
Member

@bennuttall Thanks for your PRs, but you should probably be aware that this is only a temporary workaround for your problem. The bigger issue is that piwheels.org does not expose the data-requires-python attribute as specified in PEP 503. Even if you only ever support Python 2, it will cause problems as packages drop support for Python 3.4, 3.5, 3.6, etc at different times.

Shipping a .py3 wheel instead of a py2.py3 wheel is an expedient workaround today, but it only papers over the deeper problem.

@bennuttall
Copy link
Contributor Author

Thanks @pganssle I'll open an issue on piwheels

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment