Long time ago I've installed matplotlib which I need to remove. I did it from the source, so if I go to synaptic manager (I use ubuntu) then I don't see matplotlib installed. But I found /usr/local/lib/python2.7/dist-packages/matplotlib. My question is how to correctly delete this library?


Remove it by a judicious use of rm.

If you installed it outside your package manager, why do you expect the package manager to know how to remove it?

Note that this of course means that any programs that rely on this library won't work anymore, and since it's outside of package management nothing will warn you about it.

  • but what about other dependence? Is the library present only in one place? – ashim Feb 28 '13 at 19:56
  • That's up to you to determine, unfortunately. You can do things like ldd to determine if the library depends on others, but it won't tell you if the dependancies are orphaned or not. – PaulProgrammer Feb 28 '13 at 20:01

First you should check what version of mathplotlib you have installed. There should be __version__ variable in __init__.py which defines version of lib. Next you need to download sources of this lib from their homepage. After that:

tar xvf matplotlib-VERSION.tar.gz
mkdir ~/temp-mpl
cd matplotlib-VERSION
python setup.py build
python setup.py install --home ~/temp-mpl --record list.txt

After that in list.txt there should be list of files that are installed by mathplotlib in your version. So then you need to replace in it your prefix ~/temp-mpl to path where your mathplotlib is installed and remove for example in this way:

cat list.txt | xargs rm -rf

It will remove all files installed by your specific version of mathplotlib. If you installed some dependencies manually you need to know what it was to remove it.

Remember to remove ~/temp-mpl.

BTW, why you installed it from sources? There is python-matplotlib in repo.

  • I cannot guarantee that it will remove all files from matplotlib and that it will not remove any other files, so you should be careful... – pbm Feb 28 '13 at 20:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.