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

Use python_requires to check the python version so py2.py3 wheels are not built and pip will work correctly. #3067

Closed
bryder opened this issue Jan 21, 2021 · 1 comment · Fixed by #3120
Milestone

Comments

@bryder
Copy link

bryder commented Jan 21, 2021

Problem

  • The wheels being built for ipywidgets claim it is python 2 compatible. eg ipywidgets-7.6.3-py2.py3-none-any.whl
  • Modern versions of pip do not understand that ipywidgets is not python 2 compatible. setup.py is not run when downloading a wheel.

So it installs it without error on python 2.

I believe the py2.py3 wheels are being built because the python_requires argument is not being passed to setup but I do not know that for sure.

Proposed Solution

Add a python_requires argument to the setup call to solve it.

EG Add this to setup_args in setup.py

python_requires = '>=3.5',

Then you can remove this

#-----------------------------------------------------------------------------
# Minimal Python version sanity check
#-----------------------------------------------------------------------------

import sys

v = sys.version_info
if v[:2] < (3, 5):
    error = "ERROR: %s requires Python version 3.5 or above." % name
    print(error, file=sys.stderr)
    sys.exit(1)

This issue from another project has a very good description of the problem and how to solve it

PLOS/allofplos#20

@jasongrout jasongrout added this to the 8.0 milestone Feb 5, 2021
@jasongrout
Copy link
Member

As far as I know, ipywidgets 7.x does support python 2 (this is in the 7.x branch in the repo). The upcoming 8.0 release will drop support for python 2, and indeed I agree it should use python_requires. We'd definitely welcome a pull request updating setup.py to use python_requires!

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

Successfully merging a pull request may close this issue.

2 participants