raspbian python3 import numpy and pandas issue
See original GitHub issuenumpy (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:
- 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.
- 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:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Probably a dulicate of gh-11110 which suggests either
or
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.