Hello,
I'm new to Raspberry Pi, using the 3B+. Using the Thonny IDE. Trying to just import matplotlib and getting errors related to Numpy. I am running Python 3.5.3. matplotlib 3.0.2 and numpy 1.16.0. Below, as the template states, is my code (just importing matplotlib.pyplot). This is a new Pi. All I have done is had the system update upon setup, and updated both matplotlib and numpy to get them to their most recent stable version. Any help you can give me to help me solve this would be appreciated.
import matplotlib.pyplot as plt
Below is the error message I receive in the shell:
Traceback (most recent call last):
File "/home/pi/.local/lib/python3.5/site-packages/numpy/core/__init__.py", line 16, in
from . import multiarray
File "/usr/lib/python3/dist-packages/thonny/backend.py", line 317, in _custom_import
module = self._original_import(args, *kw)
File "/home/pi/.local/lib/python3.5/site-packages/numpy/core/multiarray.py", line 12, in
from . import overrides
File "/usr/lib/python3/dist-packages/thonny/backend.py", line 317, in _custom_import
module = self._original_import(args, *kw)
File "/home/pi/.local/lib/python3.5/site-packages/numpy/core/overrides.py", line 9, in
from numpy.core._multiarray_umath import add_docstring, ndarray
File "/usr/lib/python3/dist-packages/thonny/backend.py", line 317, in _custom_import
module = self._original_import(args, *kw)
ImportError: libf77blas.so.3: cannot open shared object file: No such file or directory
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/pi/Documents/Test/Test.py", line 1, in
import matplotlib.pyplot as plt
File "/usr/lib/python3/dist-packages/thonny/backend.py", line 317, in _custom_import
module = self._original_import(args, *kw)
File "/home/pi/.local/lib/python3.5/site-packages/matplotlib/__init__.py", line 141, in
from . import cbook, rcsetup
File "/usr/lib/python3/dist-packages/thonny/backend.py", line 317, in _custom_import
module = self._original_import(args, *kw)
File "/home/pi/.local/lib/python3.5/site-packages/matplotlib/cbook/__init__.py", line 33, in
import numpy as np
File "/usr/lib/python3/dist-packages/thonny/backend.py", line 317, in _custom_import
module = self._original_import(args, *kw)
File "/home/pi/.local/lib/python3.5/site-packages/numpy/__init__.py", line 142, in
from . import core
File "/usr/lib/python3/dist-packages/thonny/backend.py", line 317, in _custom_import
module = self._original_import(args, *kw)
File "/home/pi/.local/lib/python3.5/site-packages/numpy/core/__init__.py", line 47, in
raise ImportError(msg)
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
Here is how to proceed:
git clean -xdf
Note: this error has many possible causes, so please don't comment on
an existing issue about this - open a new one instead.
Original error was: libf77blas.so.3: cannot open shared object file: No such file or directory
updated both matplotlib and numpy to get them to their most recent stable version
How did you do this? You apparently are missing something in your libblas3 installation or libblas3-dev installation from apt get install
.
Mattip,
I used ‘sudo apt-get install matplotlib’ and ‘sudo apt-get install numpy’
Is there a better way to do this?
Thank you for your help!
Is libf77blas
installed?
apt get
does not use our code, rather packages produced by your OS maintainer. While it is the best method to make sure everything is properly updated to the same version, apparently something went wrong. You should carefully observe any warnings or error messages when you install, and look on your OS maintainer's issue tracker for similar problems.
So I was able to solve the problem thanks to the help of the great community here. Using
sudo apt-get install libatlas-base-dev
fixed the issue. I guess Rasbian did not have all of the dependent libraries.
Hopefully this will be helpful to some other new users! Thanks everyone for your help.
Most helpful comment
So I was able to solve the problem thanks to the help of the great community here. Using
sudo apt-get install libatlas-base-dev
fixed the issue. I guess Rasbian did not have all of the dependent libraries.
Hopefully this will be helpful to some other new users! Thanks everyone for your help.