Opened 12 years ago

Closed 12 years ago

#18115 closed Cleanup/optimization (fixed)

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

Reported by: Carl Meyer 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 by anonymous, 12 years ago

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 by Karen Tracey, 12 years ago

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 by Aymeric Augustin, 12 years ago

I suggested a possible solution there...

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

Last edited 12 years ago by Aymeric Augustin (previous) (diff)

comment:4 by Carl Meyer, 12 years ago

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 by Ramiro Morales, 12 years ago

#18203 reported this again.

comment:6 by Jannis Leidel, 12 years ago

Triage Stage: UnreviewedReady for checkin

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

comment:7 by Carl Meyer <carl@…>, 12 years ago

Resolution: fixed
Status: newclosed

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