How to install an earlier version of matplotlib?

6,559

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/

Share:
6,559

Related videos on Youtube

Jim Blum
Author by

Jim Blum

Updated on September 18, 2022

Comments

  • Jim Blum
    Jim Blum over 1 year

    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

    • Admin
      Admin almost 10 years
      what is your ubuntu version?
    • Jim Blum
      Jim Blum almost 10 years
      @user301039 its's 14.04. Do you have something in mind?