[Python-modules-team] Bug#562544: python-pip: pip install && pip uninstall fails to uninstall, when not in virtualenv
Mike Fogel
mike at fogel.ca
Fri Dec 25 17:46:39 UTC 2009
Package: python-pip
Version: 0.6.1-1
Severity: normal
Hi there,
Running 'pip uninstall' on a python package installed with 'pip install', when not running in a virtualenv, fails. Pip expects the egg-info directory to be in a different place than where debian's setuptools placed it. It's thus unable to find it and retrieve the 'installed-files.txt' file.
For example, using a random python package 'django-ajax-validation'
mike at 110psi:~$ sudo pip freeze | grep django-ajax-validation
mike at 110psi:~$ ls -l /usr/lib/python2.5/site-packages/ | grep ajax
mike at 110psi:~$ sudo pip install django-ajax-validation
Downloading/unpacking django-ajax-validation
Downloading django-ajax-validation-0.1.3.tar.gz
Running setup.py egg_info for package django-ajax-validation
zip_safe flag not set; analyzing archive contents...
Installed /home/mike/build/django-ajax-validation/setuptools_git-0.3.4-py2.5.egg
Installing collected packages: django-ajax-validation
Successfully installed django-ajax-validation
mike at 110psi:~$ sudo pip freeze | grep django-ajax-validation
django-ajax-validation==0.1.3
mike at 110psi:~$ ls -l /usr/lib/python2.5/site-packages/ | grep ajax
drwxr-xr-x 4 root root 4096 2009-12-25 09:03 ajax_validation
drwxr-xr-x 2 root root 4096 2009-12-25 09:03 django_ajax_validation-0.1.3.egg-info
mike at 110psi:~$ sudo pip uninstall django-ajax-validation
Uninstalling django-ajax-validation:
Proceed (y/n)? y
Successfully uninstalled django-ajax-validation
mike at 110psi:~$ sudo pip freeze | grep django-ajax-validation
django-ajax-validation==0.1.3
mike at 110psi:~$ ls -l /usr/lib/python2.5/site-packages/ | grep ajax
drwxr-xr-x 4 root root 4096 2009-12-25 09:03 ajax_validation
drwxr-xr-x 2 root root 4096 2009-12-25 09:03 django_ajax_validation-0.1.3.egg-info
The problem is that 'pip install' used to python-setuptools to install the egg-info directory, and it was installed using the name format:
%name-%version.egg-info
While 'pip uninstall' expects to find it as
%name-%version-py%python-version.egg-info
Note that Debian's python-setuptools contains this patch: http://patch-tracker.debian.org/patch/misc/view/distribute/0.6.8-1/setuptools/command/install_egg_info.py which causes the egg-info directory to be named "%name-%version.egg-info" rather than "%name-%version-py%python-version.egg-info", when not in a virtualenv.
On uninstall, pip computes the egg-info directory name as "%name-%version-py%python-version.egg-info". This is done on line #'s 1996-1997 on pip.py using:
1996 pip_egg_info_path = os.path.join(dist.location,
1997 dist.egg_name()) + '.egg-info'
dist.egg_name() is a call to Requirement.egg_name() from pkg-resources, and returns an string formatted as "%name-%version-py%python-version"
thanks!
-- System Information:
Debian Release: squeeze/sid
APT prefers testing
APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.30-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages python-pip depends on:
ii python 2.5.4-4 An interactive high-level object-o
ii python-pkg-resources 0.6.8-1 Package Discovery and Resource Acc
ii python-setuptools 0.6.8-1 Python Distutils Enhancements (set
ii python-support 1.0.6 automated rebuilding support for P
python-pip recommends no packages.
python-pip suggests no packages.
-- no debconf information
More information about the Python-modules-team
mailing list