Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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.

share|improve this answer
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.

share|improve this answer
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 posting your answer, you agree to the privacy policy and terms of service.

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