3

I have matplotlib 1.3.1 installed on my computer. However I have to run some code that runs with matplotlib 1.1.1 but not with 1.3.1.

Therefore I should remove this version and installed 1.1.1.

How is this possible without breaking my python installation or anything else?

And in addition how I prevent my computer from updating this library?

I have Ubuntu 14.04 64bit

2
  • what is your ubuntu version?
    – user308564
    Jul 9, 2014 at 16:45
  • @user301039 its's 14.04. Do you have something in mind?
    – Jim Blum
    Jul 9, 2014 at 16:55

1 Answer 1

2

Apart of the obvious solution of upgrading your code to work with the new versions of Matplotlib, you could perfectly install matplotlib in a virtual environment. For that you need to install the virtualenv package, then create your virutalenv (I will make it short and explain at the end):

mkdir matplotlib_1.1.1
cd matplotlib_1.1.1
virtualenv env
env/bin/pip install numpy
env/bin/pip install https://pypi.python.org/packages/source/m/matplotlib/matplotlib-1.1.1.tar.gz

If you used virtualenv/pip most of this isn't new. First we create and move to a new directory, then we create the virtual environment in the env directory. We proceed to install numpy which is one of the dependencies of matplotlib, and finally we manually select and install the sources of matplotlib with the version of our preference.

You can now use env/bin/python to open a interactive python shell, or run source env/bin/activate to change temporally the default python binaries.

Ah, btw, this doesn't require you to remove your already installed version of matplotlib, if you don't want to.

More reading about pip and virtualenv as well as some references http://www.dabapps.com/blog/introduction-to-pip-and-virtualenv-python/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .