I went to https://matplotlib.org/users/installing.html to install the program on a pi zero w running raspbian stretch, updated, upgraded. I started with "Installing Official Release." Sounds good, right? As I executed the first instruction,
Code: Select all
python -m pip install -U pipCode: Select all
sudo apt-get install python3-matplotlibSo, I ran my hastily coded trial program I called 'temp.'
Code: Select all
user@host:~/esi $ sudo python temp
Traceback (most recent call last):
File "temp", line 4, in <module>
import matplotlib as mpl
ImportError: No module named matplotlib
user@host:~/esi $ cat temp
#/usr/bin/python
#
import os
import matplotlib as mpl
mpl.use("Agg")
import numpy as np
import matplotlib.pyplot as plt
plt.rcParams['text.usetex']=True
data=np.random.rand(50,50)
plt.imshow(data, interpolation='nearest')
plt.xlabel('X Label')
plt.savefig('agg.eps')
os.system('epspdf agg.eps agg.pdf')
x=[5,2,9,4,7]
y=[10,5,8,4,2]
plt.plot(x,y)
plt.show()Code: Select all
python -m pip install -U matplotlibCode: Select all
sudo apt install libffi-dev libffi6
sudo pip3 install cffi
sudo pip3 install cairocffiNow, I'm so confused over python and python3, over matplotlib and matplotlib.pyplot, and wheels and pips that I can't even understand what I'm reading anymore. Here is a little more information that might or might not be helpful.
Code: Select all
usr@host:~/esi $ sudo python temp
Traceback (most recent call last):
File "temp", line 4, in <module>
import matplotlib as mpl
ImportError: No module named matplotlib
usr@host:~/esi $ apt-cache policy python-matplotlib
python-matplotlib:
Installed: (none)
Candidate: 2.0.0+dfsg1-2
Version table:
2.0.0+dfsg1-2 500
500 http://mirrordirector.raspbian.org/raspbian stretch/main
armhf Packages
usr@host:~/esi $ apt-cache policy python3-matplotlib
python3-matplotlib:
Installed: 2.0.0+dfsg1-2
Candidate: 2.0.0+dfsg1-2
Version table:
*** 2.0.0+dfsg1-2 500
500 http://mirrordirector.raspbian.org/raspbian stretch/main
armhf Packages 100 /var/lib/dpkg/status
usr@host:~/esi $ sudo find / -name matplotlib*
/home/pi/Documents/matplotlib_fail.odt
/home/pi/.cache/pip/wheels/55/b7/9b/bb44c9cc9b63cf0ee150537dbcd78717f499c4e2fd2dc6f7a9/matplotlib-2.2.4-cp27-cp27mu-linux_armv6l.whl
/home/pi/.cache/matplotlib
/root/.config/matplotlib
/root/.cache/matplotlib
/etc/matplotlibrc
/usr/share/matplotlib
/usr/share/matplotlib/mpl-data/images/matplotlib.ppm
/usr/share/matplotlib/mpl-data/images/matplotlib.png
/usr/share/matplotlib/mpl-data/images/matplotlib_large.png
/usr/share/matplotlib/mpl-data/images/matplotlib.pdf
/usr/share/matplotlib/mpl-data/images/matplotlib.svg
/usr/share/matplotlib/matplotlib.conf
/usr/share/matplotlib/matplotlib.conf/matplotlibrc.template
/usr/lib/python3/dist-packages/matplotlib
/usr/lib/python3/dist-packages/matplotlib-2.0.0-nspkg.pth
/usr/lib/python3/dist-packages/matplotlib-2.0.0.egg-info
find: ‘/run/user/1000/gvfs’: Permission deniedI've seen many posts about matplotlib installation, but most say things like it works with python 2.7 but not python3. In my case, my pi can't even find it after a successful install.
If someone could perhaps get me back on the right track, I would certainly appreciate it.