robdog12
Posts: 2
Joined: Mon Mar 05, 2018 5:43 am

Installing numpy python3

Mon Mar 05, 2018 6:44 am

Hi,

I am new to raspberry pie and need to install numpy, pandas, script and Matplotlib for python3. When I install numpy with

Code: Select all

pip3 install numpy
it installs ok. When I try to import numpy within python3 code I get the error

Code: Select all

Original error was: libf77blas.so.3: cannot open shared object file: No such file or dircetory
Without numpy working none of the other packages which are dependent on numpy work either.

I have been trying to fix this for three days and have reinstalled Rasparian 4 times but I haven't made any real progress.

Does anyone know how to fix this?

User avatar
KLL
Posts: 1453
Joined: Wed Jan 09, 2013 3:05 pm
Location: thailand

Re: Installing numpy python3

Mon Mar 05, 2018 11:36 am

did you try (but i not tested)?


From the terminal run:

sudo apt-get install python3-numpy


For for plotting graphs use pylab:

sudo apt-get install python3-matplotlib

scotty101
Posts: 4491
Joined: Fri Jun 08, 2012 6:03 pm

Re: Installing numpy python3

Mon Mar 05, 2018 11:58 am

Try installing it with piwheels

https://www.raspberrypi.org/blog/piwheels/

This should be quicker once setup as it will find a version of numpy that is built for the raspberry pi rather than having to build it from source.
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

robdog12
Posts: 2
Joined: Mon Mar 05, 2018 5:43 am

Re: Installing numpy python3

Fri Mar 09, 2018 3:04 am

Hi KLL and Scottie101,

I had previously tried the:

Code: Select all

sudo apt-get install python3-numpy 
But previously I made the mistake of not removing the broken version of numpy before attempting to install using apt-get. This meant it didn't install because it registered a version of numpy already installed.
To remove the old version of numpy:

Code: Select all

pip3 uninstall numpy
Once I removed numpy I could install it using KLL's recommended method.

Code: Select all

sudo apt-get install python3-numpy 
Thanks for your help it is all working now.

User avatar
ben_nuttall
Posts: 258
Joined: Sun Aug 19, 2012 11:19 am
Location: Manchester, UK

Re: Installing numpy python3

Thu Sep 27, 2018 9:58 pm

It's not very clear but this shows that a shared object file is missing. The numpy you get from piwheels depends on libatlas.

When installing numpy using pip, you also need to install libatlas3-base:

Code: Select all

sudo apt install libatlas3-base
sudo pip3 install numpy
I wrote about this process on the piwheels blog, hope it helps: https://blog.piwheels.org/how-to-work-o ... n-package/

Why choose to pip install from piwheels instead of using apt? It's a much newer version, and new releases are available quickly. The version in Debian/Raspbian is older and will not be updated besides whole distro upgrades like Jessie -> Stretch.
Former RPF staff. Author of gpiozero and creator of piwheels.

User avatar
Chris.KB3CS
Posts: 1
Joined: Wed Nov 28, 2018 5:50 pm

Re: Installing numpy python3

Wed Nov 28, 2018 5:57 pm

i did not use pip3 to install numpy and the apt repo served up the latest version of numpy.
i had the same missing libf77blas.so error until i did "apt install libatlas3-base" .. then numpy (and matplotlib) started working immediately. ;)

dannystaple
Posts: 23
Joined: Sat Dec 24, 2011 10:16 am

Re: Installing numpy python3

Thu Mar 28, 2019 10:10 am

I'm wandering if dependancies like libatlas could be listed here https://www.piwheels.org/project/numpy/ (and similarly for other packages).

Happy to contribute metadata somewhere if there's a place to do it...

Return to “Beginners”