On Java, Python, Groovy, Grails, Spring, Node.js, Linux, Arduino, ARM, Embedded Devices & Web

  • Recent Posts

    September 2016
    M T W T F S S
    « Aug   Oct »
  • Subscribe Options

  • Awards

  • Most Valuable Blogger @ DZone
  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 173 other followers

  • Follow MyThinkPond on
  • Blog Stats

    • 364,698 hits
  • General Options

Uninstall python eggs that you installed using

Posted by Venkatt Guhesan on September 30, 2016

python_logoIn Python, most libraries are available using the pip install process. But for cases, where you are distributing code to be installed in customer sites where you may or may not have a internet connection to the pip libraries, you resort to the legacy process.

When you install using the process, the copies it’s collection of python files to the site-packages folder for your python virtual-environment. On a CentOS, this might be a location under (/usr/lib/python2.7/site-packages/) directory. This may also write it’s files to other locations such as config files and resource files.

Once installed and if you decide you want to uninstall or upgrade the package or egg, it’s hard to identify all the files that this egg touched. Within the process there are some other options that can help you in identifying the python files that are placed in these locations. Here is an example of how you can identify the files and remove the files before upgrading.

# To note down the list of files that are installed
python install --record egg-files.txt
# To remove those files you can do the following using the egg-files.txt
cat egg-files.txt | xargs rm -rf
# This would remove the individual files but will leave the "<project>.egg-info" directory and other artifacts under site-packages. 
# You can remove the package directories manually

On the other hand, if you have access to pip then you can leverage “pip freeze” options (read more here) along with “pip uninstall” option (read more here).



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: