Opened 3 years ago

Closed 3 years ago

#18115 closed Cleanup/optimization (fixed)

Warn that repeated "setup.py install" without removal causes problems

Reported by: carljm Owned by: nobody
Component: Documentation Version: 1.4
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

If you repeatedly install newer versions of Django (or any other Python project) using "python setup.py install", without removing the previously-installed version, any files removed in the newer version will never be removed from your site-packages. This can potentially cause a variety of problems, including imports continuing to "work" (with outdated code) that ought to fail, and most visibly in Django 1.4, extraneous files in the startproject template.

The installation instructions ought to include a clear warning against this. Currently there's a bit of a warning at the end of this section, but it's not as clear as it could be about the specific risk of repeated "setup.py install", and it's in the section about installing using a pth file or symbolic link, which is a different thing entirely.

Change History (7)

comment:1 Changed 3 years ago by anonymous

Please add a note how to detect Django version and path:

>>> import django
>>> django.VERSION
(1, 3, 0, 'final', 0)
>>> django.__file__
'/home/lucianopacheco/src/tmp_py/local/lib/python2.7/site-packages/django/__init__.pyc'

So, it will be much more clear to people not familiar with python installation structure to understand what "site-packages" means.

comment:2 Changed 3 years ago by kmtracey

We did used to note that you had to get rid of any old install before re-install: https://docs.djangoproject.com/en/1.0/topics/install/#remove-any-old-versions-of-django

Not that everyone read/did that (possibly because the instructions were not exactly specific, since there wasn't any official way to "uninstall"?), leading to tickets like #9090 and #9112.

But we should definitely put a note back around instructions to use setup.py that if you've already got Django installed it needs to be removed first before you run setup.py again. Possibly a stronger note than used to be there.

comment:3 Changed 3 years ago by aaugustin

I suggested a possible solution there...

[EDIT] ... and it doesn't work, as explained down the thread.

Last edited 3 years ago by aaugustin (previous) (diff)

comment:4 Changed 3 years ago by carljm

  • Has patch set

I filed a pull request for both a documentation update and a change to setup.py that will warn users who are installing on top of an existing install. More details in the pull request summary. Comments welcome here or on the pull request. If there are no comments I'll merge it in a few days.

comment:5 Changed 3 years ago by ramiro

#18203 reported this again.

comment:6 Changed 3 years ago by jezdez

  • Triage Stage changed from Unreviewed to Ready for checkin

I looked at the pull request and think it's ready to go.

comment:7 Changed 3 years ago by Carl Meyer <carl@…>

  • Resolution set to fixed
  • Status changed from new to closed

In [6ed7d40727f70934df6ab0ac96f5f1c4f01c534f]:

Fixed #18115 - added warning about overlaid install.

Setup.py now warns if it detects that Django is being installed over top
of a previous installation that was never removed. This should only
happen when installing with python setup.py install, as pip
automatically uninstalls before installing a new version and
easy_install installs as an egg directory.

Also generally updated the installation doc.

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