I'm not sure if this is a Raspberry Pi issue, Raspbian Issue, Python Issue, or all of the above. So forgive me if this is the wrong place to ask this.

I just got me a Raspberry Pi 3B+ and installed the latest Raspbian image on the SD card for it. In other words, it's a "clean slate".

When I go into Python (3.5), and type "Import numpy", numpy imports with no problem. This is the Numpy provided by the image, and NOT the numpy I try to install from pip (version 1.12.1 to be exact).

When I try to upgrade to the latest version however (version 1.15.4), using "pip3 install numpy", it seems to install ok, but when I go to import it, I get the following:

**Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.5/site-packages/numpy/core/__init__.py", line 16, in <module>
    from . import multiarray
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 "<stdin>", line 1, in <module>
  File "/home/pi/.local/lib/python3.5/site-packages/numpy/__init__.py", line 142, in <module>
    from . import add_newdocs
  File "/home/pi/.local/lib/python3.5/site-packages/numpy/add_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
  File "/home/pi/.local/lib/python3.5/site-packages/numpy/lib/__init__.py", line 8, in <module>
    from .type_check import *
  File "/home/pi/.local/lib/python3.5/site-packages/numpy/lib/type_check.py", line 11, in <module>
    import numpy.core.numeric as _nx
  File "/home/pi/.local/lib/python3.5/site-packages/numpy/core/__init__.py", line 26, in <module>
    raise ImportError(msg)
Importing the multiarray numpy extension module failed.  Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control).  Otherwise reinstall numpy.
Original error was: libf77blas.so.3: cannot open shared object file: No such file or directory**

When I type "pip3 uninstall numpy", it successfully removes the 1.15.4 version, and replaces it with the 1.12.1 version. I even tried typing "pip3 uninstall numpy" AGAIN to see if it would remove the 1.12.1 version, but I get the following:

**Not uninstalling numpy at /usr/lib/python3/dist-packages, outside environment /usr**

The funny thing is, I tried (just for kicks) installing numpy with "pip install numpy" for Python 2.7, and there were no problems at all importing it. But I want to use Python 3, not 2. I don't recall having this much problems with one of the earlier versions of Raspbian, and I THINK it has to do something with Numpy coming preinstalled in the image.

Thanks for any replies!


1 Answer 1


First of all I'm assuming you're running Raspbian Stretch.

What I would do is uninstall old numpy version, install prerequisites and then install numpy again.

sudo apt update
sudo apt remove python3-numpy
sudo apt install libatlas3-base
sudo pip3 install numpy

Don't use sudo with pip3 installif you're installing numpy in a virtual environment. I can also not quite make out if you have a locally installed numpy, so you could run pip3 uninstall numpy (without sudo) first.

  • Yeah, I should have mentioned that I was running stretch. Sorry about that. I THINK that Numpy is running locally (I haven't done anything like virtual environments or the like). I basically just got the image, put it on an SD card, and tried to update. I Tried what you suggested, and removed the python3-numpy (I don't know why I hadn't thought of that before), but it still gave me the same errors when I reinstalled with pip3. Thanks anyway! I'll just wait a few months for another update of Raspbian to try this again.
    – ChrisVon
    Dec 7, 2018 at 18:47
  • I THINK that Numpy is running locally If you install using pip3 without sudo it will install locally. That doesn't always work well, especially if you need to run your python code with sudo.
    – Dirk
    Dec 7, 2018 at 18:53
  • @ChrisVon Try also installing libatlas3-base (using apt)
    – Dirk
    Dec 7, 2018 at 18:56
  • SIIIIIIIIGGGGGGHHHHHHH!!!! The libatlas3-base thing worked. Thanks Dirk! Our of curiosity, how did you know it was that?
    – ChrisVon
    Dec 7, 2018 at 19:24
  • @ChrisVon I had a note of it (I just made a mistake first time around). And I double checked by searching for libf77blas.so.3 in Debian package db (make sure you choose to search for package contents). This hopefully finds the package that contains the file :)
    – Dirk
    Dec 7, 2018 at 19:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.