Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#28878 closed Bug (fixed)

"pip install django" is broken on Python 2; can be fixed for most users with metadata

Reported by: Zac Hatfield Dodds Owned by: nobody
Component: Packaging Version: 2.0
Severity: Release blocker Keywords:
Cc: Sergey Fedoseev Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

For users on Python 2, 'pip install django' should install the latest compatible version, which is 1.11.x.

Unfortunately, it currently tries to install Django 2.0, and setup.py throws an error (the details are unimportant, except that it's a terrible user experience). This is unfortunately inevitable for users with very old versions of pip, who are therefore out of luck unless they upgrade it.

For any user with pip 9+ though, we can use the python-requires argument to 'setuptools.setup'. All users will then transparently get the latest version that is compatible with their Python, and all will be well.

http://www.python3statement.org/practicalities/ has a range of further advice on making this process as smooth as possible, including tips about setuptools versions and where to insert explicit warnings and errors for users who somehow get an incompatible version anyway.

I'd be happy to review any patches in relation to this, or help write them if someone can help with django-specific questions :-)

Change History (9)

comment:1 by Sergey Fedoseev, 7 years ago

Cc: Sergey Fedoseev added

comment:2 by Sergey Fedoseev, 7 years ago

Triage Stage: UnreviewedAccepted

comment:3 by Zac Hatfield Dodds, 7 years ago

Has patch: set

PR

I've made the patch against master, and included some notes on backporting and required edits to the PyPI listing in the pull description. Very happy to hear any feedback!

comment:4 by Tim Graham <timograham@…>, 7 years ago

Resolution: fixed
Status: newclosed

In 32ade4d7:

Fixed #28878 -- Added python_requires in setup.py and a warning for older pips that don't recognize it.

comment:5 by Tim Graham <timograham@…>, 7 years ago

In 45d89856:

[2.0.x] Fixed #28878 -- Added python_requires in setup.py and a warning for older pips that don't recognize it.

Backport of 32ade4d73b50aed77efdb9dd7371c17f89061afc from master

comment:6 by Andy Grabow, 7 years ago

Resolution: fixed
Status: closednew

After researching for quite a while, i found this ticket and that the actual problem has been kinda solved with django 2.0.1 (without mentioning it in the release notes tho).
BUT any python2 pip ist still trying to install django 2, because the packages currently uploaded to pypi need to be modified to also include this fix!

After getting in rage about this for almost two days now i can confirm that django==2.0.1 will not install in python2 (with a recent pip version) - YAY
BUT the original releases need to be updated, so that automated travis tests are not that complicated to setup and people can savely install the latest compatible django under python2.

in reply to:  6 comment:7 by Zac Hatfield Dodds, 7 years ago

Replying to Andy Grabow:

BUT any python2 pip ist still trying to install django 2, because the packages currently uploaded to pypi need to be modified to also include this fix!

We know - it's impossible to edit existing releases on PyPI, but I've asked for an admin to do it for us. We'll see what happens.

comment:8 by Andy Grabow, 7 years ago

Resolution: fixed
Status: newclosed

okay, good to know! i hope this works out! should be possible for a project as big as this!

in reply to:  8 comment:9 by Zac Hatfield Dodds, 7 years ago

Replying to Andy Grabow:

okay, good to know! i hope this works out! should be possible for a project as big as this!

Yep, all done - this ticket is as resolved now as it can possibly be.

Note: See TracTickets for help on using tickets.
Back to Top