question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

raspbian python3 import numpy and pandas issue

See original GitHub issue

numpy (and pandas) will not import

Reproducing code example:

My code works fine everywhere else, e.g. home PC, AWS instance. Moved it onto my Raspberry Pi 1 B and the code fails. It also fails the same way in ipython3, as shown below.

pi@raspberrypi:~/python/stocks $ ipython3 Python 3.7.3 (default, Dec 20 2019, 18:57:59) Type “copyright”, “credits” or “license” for more information.

IPython 5.8.0 – An enhanced Interactive Python. ? -> Introduction and overview of IPython’s features. %quickref -> Quick reference. help -> Python’s own help system. object? -> Details about ‘object’, use ‘object??’ for extra details.

In [1]: import numpy as np

ImportError Traceback (most recent call last) /usr/local/lib/python3.7/dist-packages/numpy/core/init.py in <module>() 23 try: —> 24 from . import multiarray 25 except ImportError as exc:

/usr/local/lib/python3.7/dist-packages/numpy/core/multiarray.py in <module>() 13 —> 14 from . import overrides 15 from . import _multiarray_umath

/usr/local/lib/python3.7/dist-packages/numpy/core/overrides.py in <module>() 6 ----> 7 from numpy.core._multiarray_umath import ( 8 add_docstring, implement_array_function, _get_implementing_args)

ImportError: libf77blas.so.3: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

ImportError Traceback (most recent call last) <ipython-input-1-0aa0b027fcb6> in <module>() ----> 1 import numpy as np

/usr/local/lib/python3.7/dist-packages/numpy/init.py in <module>() 140 from . import _distributor_init 141 –> 142 from . import core 143 from .core import * 144 from . import compat

/usr/local/lib/python3.7/dist-packages/numpy/core/init.py in <module>() 52 “”" % (sys.version_info[0], sys.version_info[1], sys.executable, 53 version, exc) —> 54 raise ImportError(msg) 55 finally: 56 for envkey in env_added:

ImportError:

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy c-extensions failed.

  • Try uninstalling and reinstalling numpy.

  • If you have already done that, then:

    1. Check that you expected to use Python3.7 from “/usr/bin/python3”, and that you have no directories in your PATH or PYTHONPATH that can interfere with the Python and numpy version “1.18.2” you’re trying to use.
    2. If (1) looks fine, you can open a new issue at https://github.com/numpy/numpy/issues. Please include details on:
      • how you installed Python
      • how you installed numpy
      • your operating system
      • whether or not you have multiple versions of Python installed
      • if you built from source, your compiler versions and ideally a build log
  • If you’re working with a numpy git repository, try git clean -xdf (removes all files not under version control) and rebuild numpy.

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

I uninstalled pandas and python3-numpy and reinstalled. It made no difference. I checked in the /usr/bin/python3 which showed this:-

pi@raspberrypi:~/python/stocks $ ls -all /usr/bin/python3 lrwxrwxrwx 1 root root 9 Mar 26 2019 /usr/bin/python3 -> python3.7

Any help would be greatly appreciate. Thanks, Markus

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
mattipcommented, Apr 1, 2020

Probably a dulicate of gh-11110 which suggests either

sudo apt-get install libatlas-base-dev

or

pip3 uninstall numpy #remove previously installed package
apt install python3-numpy
0reactions
markusmartiuscommented, Apr 13, 2020

Sorry for the delayed reply. Due to Covid19 and working from home, I had stopped working on this problem.
I did try mattip’s solution and it worked as well, thank you for that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pandas import error on older Numpy version on Raspbian
On a fresh install of Raspbian 10 on Raspberry PI 3 B+, I am trying to install with Python 3.7 the numpy==1.19.5 ....
Read more >
Installing numpy python3 - Raspberry Pi Forums
I am new to raspberry pie and need to install numpy, pandas, ... When I try to import numpy within python3 code I...
Read more >
How do I install pandas on Raspberry Pi?
sudo apt-get install python3-pandas works on the Raspberry Pi4 and the pandas version is 0.23 ...
Read more >
Troubleshooting ImportError — NumPy v1.25.dev0 Manual
Importing the numpy c-extensions failed. This error can happen for different reasons, often due to issues with your setup. The error also has...
Read more >
Install python3 and pandas on raspberry pi 3 - OSMC Forums
does work. It looks like the problem is that python3-pandas-lib is missing in the debian repositories for ARM.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found