This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: packaging: add tests for old versions cleanup on update
Type: behavior Stage: resolved
Components: Distutils2 Versions: Python 3.3, 3rd party
Status: closed Resolution: out of date
Dependencies: 14270 Superseder:
Assigned To: eric.araujo Nosy List: Alan.Cristhian, Sergio.Callegari, alexis, eric.araujo, illume, tarek, thomas.holmes
Priority: normal Keywords: easy

Created on 2009-02-21 22:43 by illume, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (6)
msg82586 - (view) Author: Rene Dudfield (illume) Date: 2009-02-21 22:43
A common problem is removing old files from the installed location.

version 1 installs.

version 2 installs.

However, in version 2 if we install over the top of version 1, distutils
does not remove  Which causes the package to break because will be used instead of

distutils should be able to be given a list of old files to make sure
are removed from the package.

It should work with the various installers... msi, dmg etc, as well as
when using install.

I've seen this cause breakage with numerous packages.  The solution is
to hack some old file detection into each package, or tell users 'delete
the old install first'.  Neither of which is really nice.

Specifying an old_files meta data should be able to help.
msg82588 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2009-02-21 22:52
A uninstall command, based on the record of installed files, will be
proposed for #4673.

It should adress your problem, since we will be able to add a new option
in the install command.

I am leaving this issue open so we can keep track of this need.
msg139774 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-07-04 14:36
I’m renaming this to make the status clearer: it’s about adding tests.
msg160903 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-05-16 18:04
Jonathan Fernandes started to work on this at the last Montreal sprint.  The tests would use install_local_project, which is missing a parameter to control the destination directory (see #14270).
msg200057 - (view) Author: Sergio Callegari (Sergio.Callegari) Date: 2013-10-16 12:30
Getting bitten by this with numpy/scipy installations

Having previous scipy installed,

   pip install -I scipy

creates a broken scipy installation, because the previous one is not removed and gets overwritten. For instance, an old file leftover hides the file from the new installation causing broken behavior.

Similarly trying

   pip uninstall scipy
   pip install scipy

does the same, because the distutils uninstall does not uninistall anything, leaves the scipy directory there and all cheerful ends with a 'Successfully uninstalled scipy'.

This is *dangerous*. Mixing old and new code could lead to the weirdest behavior. In principle, one could even use this property to craft packages such that when two subsequent versions are installed one on top of the other malicious things happen even if individually each version is innoquous.
msg213220 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2014-03-12 08:28
packaging is not developped anymore.  The issue described here may be relevant for projects like wheel, distlib or pip.
Date User Action Args
2022-04-11 14:56:46adminsetgithub: 49592
2014-03-12 08:28:15eric.araujosetstatus: open -> closed
resolution: out of date
messages: + msg213220

stage: test needed -> resolved
2013-10-16 16:48:05Alan.Cristhiansetnosy: + Alan.Cristhian
2013-10-16 12:30:21Sergio.Callegarisetnosy: + Sergio.Callegari
messages: + msg200057
2012-05-16 18:04:51eric.araujosetassignee: tarek -> eric.araujo
dependencies: + Can't install a project in a specific directory
messages: + msg160903
versions: + 3rd party
2011-07-06 00:04:19thomas.holmessetnosy: + thomas.holmes
2011-07-04 14:36:47eric.araujosettype: enhancement -> behavior
title: distutils removing old files, deleting unneeded old files from installed location. -> packaging: add tests for old versions cleanup on update

keywords: + easy
nosy: + alexis
versions: + Python 3.3, - 3rd party
messages: + msg139774
stage: test needed
2011-07-04 14:35:14eric.araujounlinkissue4673 dependencies
2010-10-22 14:55:51eric.araujolinkissue4673 dependencies
2010-10-22 14:55:38eric.araujosetnosy: + eric.araujo

components: + Distutils2, - Distutils
versions: + 3rd party, - Python 3.2
2010-08-09 03:22:41terry.reedysetversions: + Python 3.2, - Python 3.1, Python 2.7
2009-02-21 22:52:18tareksetmessages: + msg82588
versions: + Python 3.1, Python 2.7
2009-02-21 22:43:49illumecreate