5

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)

also:

sudo pip3 install python3-matplotlib

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

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

7 Answers 7

6

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!

1
  • 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
    Commented Aug 6, 2015 at 20:40
2

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.

1

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

ImportError: No module named 'cairocffi'

installing cairocffi solved it.

sudo pip3 install cairocffi

Cheers.

1

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

sudo apt install python3-dev

1

sudo apt update

sudo apt install python3-matplotlib

0

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

-2

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

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.