How to uninstall/update modules

Robert Kern robert.kern at gmail.com
Fri Oct 10 19:13:22 EDT 2008


pjacobi.de at googlemail.com wrote:
> Dear All,
> 
> 
> It seems I don't understand how Python packages are handled. Here's my
> specific problem
> 
> * I'm on Win32
> * I've installed Enthought Python 2.5 because it got all the numerical
> stuff included
> * Later I tried to install Twisted 8.1
> 
> Twisted ended up in
> C:\Python\Lib\site-packages\twisted
> 
> But there's an older Twisted included in the Enthought distribution.
> It is at
> C:\Python\Lib\site-packages\Twisted-2.5.0.0002-py2.5-win32.egg
> 
> Now, the strange thing (for the uninitiated, like me) is:
> 
> When doing a "import twisted" I get to older version in directory
> Twisted-2.5.0.0002-py2.5-win32.egg, not the newer version in directory
> twisted.
> 
> (A) What magic is going on in redirecting the import?
> (B) How can I switch to use the newer version?

EPD installs its packages using easy_install. The list of the currently 
activated packages are in the text file site-packages\easy-install.pth. These 
will be put first on your sys.path. The latest Twisted is also 
easy_install'able, so you could have done

   easy_install -U Twisted

to upgrade (that's what the -U does) to the latest version. The older version 
would have been removed from the easy-install.pth file and the newer version 
activated. If you wish to go that route, you can remove the twisted/ directory 
you currently have.

Alternately, if you wish to keep what you have, just remove the line in 
easy-install.pth that lists the Twisted-2.5.0.0002-py2.5-win32.egg. If you wish 
to upgrade in the future, you will have to remember to remove that directory 
before installing the new version.

This is mostly specific to EPD (disclosure: I am an Enthought employee) since 
it's related to the choice we made to use eggs for our packaging, so you can ask 
us questions on the epd-users mailing list:

   https://mail.enthought.com/mailman/listinfo/epd-users

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco




More information about the Python-list mailing list