← All tasks
pythonjupyter-widgets/ipywidgets #3067Not a task: already works

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

envgap__jupyter-widgets__ipywidgets-3067

01 / FAILURE SIGNATURE

As reported upstream

error = "ERROR: %s requires Python version 3.5 or above." % name
Not a benchmark task.
  • The project already builds and runs before the fix, so there is nothing to repair.

02 / ENVIRONMENT RECIPE

Base commit
cb8eefef43005ab47ae008d8372af43fb58dd75d
Manifest
setup.py
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

jupyter-widgets/ipywidgets #3067 · read the original issue

### 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](https://github.com/jupyter-widgets/ipywidgets/blob/90c1c14211a6be685c6077646f40973f96faced1/setup.py#L67) 



```python

python_requires = '>=3.5',

```



Then you can remove this

```python

#-----------------------------------------------------------------------------

# 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



https://github.com/PLOS/allofplos/issues/20



Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]