BlueAardvark
Posts: 1
Joined: Sun Jun 02, 2019 11:51 am

Matplotlib not installing Python 3.6.3

Sun Jun 02, 2019 12:11 pm

Hi, so I followed this tutorial: http://www.knight-of-pi.org/installing- ... pberry-pi/
and installed python 3.6.3 onto my raspberry pi zero w.

I go to install matplotlib using

Code: Select all

sudo pip3 install matplotlib
and it collects it.
downloads it, but reaches 100% and nothing, it just hangs.

I've used -vvv to see what's going on and A LOT is happening but it's too fast for me to read, then all of a sudden it just stops and no more text.
I need to use ^c to get back to the command line.

This works:

Code: Select all

sudo pip install pip-install-test
What I've tried:
Changing pip version
fresh reinstall
installing different version of matplotlib (3.0.3 instead of 3.1.0)
this method : sudo apt-get install python3-matplotlib

NOTHING WORKS PLEASE HELP.

sonettguy
Posts: 142
Joined: Wed Jan 10, 2018 7:29 pm
Location: texas, USA

Re: Matplotlib not installing Python 3.6.3

Thu Jun 13, 2019 10:22 pm

I know I'm not supposed to post 'me-too' replies, but I can add more detail to the problem definition. So, I will.

I ran into so much trouble trying to install matplotlib that I started over, formatting the SSD and re-installing the latest Raspbian Stretch (full). I then did the following.

Code: Select all

sudo apt-get remove /usr/lib/python3.5
sudo apt-get install libffi-dev libssl-dev -y
wget https://www.python.org/ftp/python/3.6.3/Python-3.6.3.tar.xz
tar xJf Python-3.6.3.tar.xz
cd Python-3.6.3
./configure          
Make                          (1hr 35m)
sudo make install    (15m)
$python3
>how, what = "holy", "Grail"
>print(f'The {how} {what}!')
The holy Grail!
>exit()
$python3 --version
Python 3.6.3
All looks good so far. I grabbed the following line from the output of 'sudo make install'.

Code: Select all

Setting up python3-numpy (1:1.12.1-3) …
OK, so let's try it.

Code: Select all

~ $ find / -name numpy
/usr/share/numpy
/usr/include/numpy
/usr/include/python2.7/numpy
/usr/include/python3.5m/numpy
/usr/lib/python2.7/dist-packages/numpy
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy
/usr/lib/python3/dist-packages/numpy
/usr/lib/python3/dist-packages/numpy/core/include/numpy
I see python3.5m survived the 'remove', so I go and manually delete that folder.

Code: Select all

$ cat temp
#!/usr/lib/python3
#
import os
print "os imported"
#import matplotlib as mpl
#print "matplotlib imported"
#mpl.use("Agg")
import numpy as np
print "numpy imported"
import matplotlib.pyplot as plt
print "pylot imported"
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]
print "data ready to plot"
plt.plot(x,y)
plt.show()

user@piname:~/esi $ sudo nano temp
user@piname:~/esi $ python3 temp
os imported
Traceback (most recent call last):
  File "temp", line 8, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
user@piname:~/esi $ sudo nano ~/.bashrc
user@piname:~/esi $ sudo nano ~/.bash_aliases
user@piname:~/esi $ python3 temp
os imported
Traceback (most recent call last):
  File "temp", line 8, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
Same thing with matplotlib. It also give a "no module named 'matplotlib' error.

So, I tried to force the program to find numpy by editing the .bashrc...rather actually a new file .bash_aliases.

Code: Select all

alias numpy = /usr/lib/python3/dist-resources/numpy
Then, I entered the following command

Code: Select all

source ~/.bashrc
Same result. It did not find 'numpy'. So, I rebooted and got the Screen of Death. It is the one you can never return from!!
Image

sonettguy
Posts: 142
Joined: Wed Jan 10, 2018 7:29 pm
Location: texas, USA

Re: Matplotlib not installing Python 3.6.3

Fri Jun 14, 2019 11:38 pm

I have noticed one thing. Knights of Pi suggest installing numpy and matplotlib. But, installing matplotlib installs numpy, giving one two copies. It seems when two copies are present, you get "no such file or directory" errors. The fix is nearly impossible...which is to find all occurrences and delete them except the one you want. Instead, it is easier to find all occurrences, delete all of them and THEN install matplotlib.

I'm say that, but I must follow it immediately by saying I have now reformatted my SSD and started over 5 times and still cannot get matplotlib and numpy to work. Strange, because it works fine on another Pi zero I have. This is one of the most frustrating times I've ever had with the pi.

Andyroo

Re: Matplotlib not installing Python 3.6.3

Fri Jun 14, 2019 11:52 pm

I found the you could have two versions of numpy at the same time depending on who / how it’s installed...

One I installed using ‘sudo apt install python-numpy -y’ and one built using wheel ‘pip wheel numpy’

For some reason I had to install both before the next bit of my install would work (Pillow in my case)...

sonettguy
Posts: 142
Joined: Wed Jan 10, 2018 7:29 pm
Location: texas, USA

Re: Matplotlib not installing Python 3.6.3

Sat Jun 15, 2019 4:41 pm

I'm wondering if @BlueAardvark and I are running into memory partitioning problems. Does anyone have a working SSD with Raspbian, Python-3.6.3 and matplotlib on it? Perhaps we need to re-partition the SSD. I tried, but the instructions I followed didn't work. I'm on my 7th format and re-install now.

User avatar
scruss
Posts: 3212
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Matplotlib not installing Python 3.6.3

Sat Jun 15, 2019 10:29 pm

Any reason why you're not happy with the stock Python 3.5.3 and

Code: Select all

sudo apt install python3-matplotlib
?

Building this takes a very long time on a Raspberry Pi.
Last edited by scruss on Thu Aug 29, 2019 4:16 pm, edited 1 time in total.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.
Pronouns: he/him

sonettguy
Posts: 142
Joined: Wed Jan 10, 2018 7:29 pm
Location: texas, USA

Re: Matplotlib not installing Python 3.6.3

Sun Jun 16, 2019 1:07 am

I don't want to answer for BlueAardvark, but when I first tried to download matplotlib I got a message that said it will no longer work with versions of python less than 3.6.

However, having tried a number of different things, I now believe that there is incompatibility between Raspbian4.14/Python-3.6.3/matplotlib. I don't believe they work together. I was wrong about the memory. I am only using 55% of the root partition. Something interferes with Raspbian. I'm going to look for an old version of maplotlib (or forget it altogether) and use 3.5.

In fact, as I look now, I see a statement on their webpage that says:
Matplotlib 3.0 is Python 3 only. For Python 2 support, Matplotlib 2.2.x will be continued as a LTS release and updated with bug fixes until January 1, 2020.

User avatar
scruss
Posts: 3212
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Matplotlib not installing Python 3.6.3

Sun Jun 16, 2019 4:20 pm

sonettguy wrote:
Sun Jun 16, 2019 1:07 am
I don't want to answer for BlueAardvark, but when I first tried to download matplotlib I got a message that said it will no longer work with versions of python less than 3.6.
But if you install from a Raspbian package, you get versions that match. Sure, they're not both the most recent versions, but they're stable and work well together. They are also versions that people here can easily help with, as they're all standard across all users.

It's tempting to go for the latest versions, but unless you know you need the features and you're confident in rebuilding huge chunks of the Python subsystem, it's probably best to stick with the standard packaged versions.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.
Pronouns: he/him

sonettguy
Posts: 142
Joined: Wed Jan 10, 2018 7:29 pm
Location: texas, USA

Re: Matplotlib not installing Python 3.6.3

Sun Jun 16, 2019 8:18 pm

Agreed, Scruss. By sticking to the Raspbian packages, do you mean installing software using "apt-get" ? Otherwise, I don't know what you mean by that phrase.

I just reformatted the 16Gb SSD, using the formatting option that is not "quick." I imaged Raspbian 4.14. I checked it, created my user, reinstalled all backup python files, ran them, and everything seemed fine. Rebooted several times along the way. Then, I installed matplotlib,

Code: Select all

~$ sudo apt-get install python3-matplotlib
~$ reboot
Now, the desktop doesn't come up. xstart command doesn't work.

User avatar
scruss
Posts: 3212
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Matplotlib not installing Python 3.6.3

Sun Jun 16, 2019 11:06 pm

matplotlib can't affect the desktop. Something else has gone wrong.

Maybe restore the boot to desktop option from sudo raspi-config
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.
Pronouns: he/him

sonettguy
Posts: 142
Joined: Wed Jan 10, 2018 7:29 pm
Location: texas, USA

Re: Matplotlib not installing Python 3.6.3

Wed Aug 28, 2019 8:23 pm

Just to conclude my contribution to this thread, I later found a bad sector on my SD card which was not picked up when formatting it. Threw it away. The new SD card is now back to where I started, but I have not attempted to install matplotlib again.

User avatar
scruss
Posts: 3212
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Matplotlib not installing Python 3.6.3

Thu Aug 29, 2019 4:24 pm

Ah. That would do it.

On Raspbian Buster, matplotlib seems to be installed by default.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.
Pronouns: he/him

sonettguy
Posts: 142
Joined: Wed Jan 10, 2018 7:29 pm
Location: texas, USA

Re: Matplotlib not installing Python 3.6.3

Thu Aug 29, 2019 4:42 pm

Now up on the pi 4, 4Gb. :D

Return to “Troubleshooting”