I hope there is a simple way to install python3-matplotlib package on my RasPi.

My OS is raspbian.

I've tried already:

sudo pip3 install matplotlib

(command gcc failed with exit status 1)


sudo pip3 install python3-matplotlib

(could not find any downloads that satisfy the requirement python3-matplotlib)

  • I've editted the question. – picibucor Apr 24 '14 at 13:24
  • 2
    did you try sudo apt-get install python3-matplotlib? – Bex Apr 24 '14 at 16:46

Aparently, the python3-matplotlib package is not available on wheezy, but on jessie. You could install it from there, but it involves a bit of dark magic with apt, and I think a better option would be to install it from source.

That, on the other hand, and according to this post, shouldn't be harder than

git clone https://github.com/matplotlib/matplotlib
cd matplotlib
python3 setup.py build
sudo python3 setup.py install

Good luck!

| improve this answer | |
  • that works, then dies during a setup of the current Pandas. So I'm back to hacking my code to work in python2 ... c'm on, raspbian; some thing come in kits! – Phlip Aug 6 '15 at 20:40

The lack of a python3-matplotlib package in wheezy is unfortunate. However pip is usually an easy alternative to get your package installed.

When you get a gcc exit status 1 upon sudo pip3 install matplotlib it is telling you the build failed. You should check the output above what the exact error is.

Sometimes the error is clear and descriptive (not enough space on SD card for example). Even if the error text doesn't give you a clue, google might offer a simple fix.

I was in the exact same situation, gcc exit status 1, but above that: No space left on device. My /tmp directory is mounted in the memory and was sized to small. I imagine I could have increase the size in memory (editing the fstab file) but I choose to mount the /tmp folder temporary on a USB stick to be certain I have enough space.

| improve this answer | |

I got an import error with a fresh install of raspbian:

ImportError: No module named 'cairocffi'

installing cairocffi solved it.

sudo pip3 install cairocffi


| improve this answer | |

If you are using python3, use the below command before installing matplotlib.

sudo apt install python3-dev

| improve this answer | |

There are some steps before installing matplotlib. Install two packages named python3-dev and libffi-dev.
On extremely old versions of Linux and Python 2.7 you may need to install the master version of subprocess32.

Installation from nothing to matplotlib and small tutorial to get first matplotlib plot in link below: http://michals-diy-electronics.blogspot.com/2018/04/matplotlib-and-raspberry-pi-3-show-my.html

| improve this answer | |

You can download then using this on the command line of Linux

sudo apt-get install python3-matplotlib
| improve this answer | |
  • As you can see in the accepted answer it has been in the repos for several years (since Raspbian Jessie) – Dirk Nov 22 '18 at 17:09

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.