0

I am using the most recent version of Rasperry Pi's OS on a Pi 4 model B. Apparently the version of python that comes with the OS is 3.9. I'm not sure if Numpy comes with it or that I installed it while installing other packages. But when I try to install as a check, the response is that it's 1.24.3. I istalled the most recent 32bit version. Now to the problem, when I run the following line in a python program. (I'm using visual studio just installed as well)

 import numpy as np

I get the following error messages: Exception has occurred: ImportError
Unable to import required dependencies: numpy:

 IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
 Importing the numpy C-extensions failed. This error can happen for
 many reasons, often due to issues with your setup or how NumPy was
 installed.
 We have compiled some common reasons and troubleshooting tips at:
 https://numpy.org/devdocs/user/troubleshooting-importerror.html
 Please note and check the following:
 * The Python version is: Python3.9 from "/bin/python"
 * The NumPy version is: "1.24.3"
 and make sure that they are the versions you expect.
 Please carefully study the documentation linked above for further help.

Original error was: libcblas.so.3: cannot open shared object file: No such file or directory

I'm not sure how to proceed. Suggestions?

asked Jun 1, 2023 at 20:54
1
  • Debian provides consistent Python modules against the version of Python it installs. Use them. Study apt install and apt-cache search. Commented Jun 1, 2023 at 21:10

4 Answers 4

1

Have you tried this solution:

What worked for me (I was missing some dependencies):

pip3 install opencv-python 
sudo apt-get install libcblas-dev
sudo apt-get install libhdf5-dev
sudo apt-get install libhdf5-serial-dev
sudo apt-get install libatlas-base-dev
sudo apt-get install libjasper-dev 
sudo apt-get install libqtgui4 
sudo apt-get install libqt4-test

It also has a similar error, so you may find soultion there.

trejder
1411 silver badge10 bronze badges
answered Jun 4, 2023 at 11:02
0

I'm not sure why it caused a problem, but I had installed the 32 bit version of Raspberry Pi. When I installed the 64 bit version, the problem went away.

answered Jun 5, 2023 at 22:49
0

You should use sudo apt install python3-numpy to install the supported version (which is 1.19.5).

Debian Bookworm (yet to be released) has 1.24.2

answered Jun 1, 2023 at 23:58
0

I got the same question,and the details are as follows:

Traceback (most recent call last):
 File "/home/pi/Desktop/Python/tkinter/lib/python3.11/site-packages/numpy/core/__init__.py", line 24, in <module>
 from . import multiarray
 File "/home/pi/Desktop/Python/tkinter/lib/python3.11/site-packages/numpy/core/multiarray.py", line 10, in <module>
 from . import overrides
 File "/home/pi/Desktop/Python/tkinter/lib/python3.11/site-packages/numpy/core/overrides.py", line 8, in <module>
 from numpy.core._multiarray_umath import (
ImportError: libopenblas.so.0: 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/Desktop/Python/tkinter/lib/python3.11/site-packages/numpy/__init__.py", line 130, in <module>
 from numpy.__config__ import show as show_config
 File "/home/pi/Desktop/Python/tkinter/lib/python3.11/site-packages/numpy/__config__.py", line 4, in <module>
 from numpy.core._multiarray_umath import (
 File "/home/pi/Desktop/Python/tkinter/lib/python3.11/site-packages/numpy/core/__init__.py", line 50, in <module>
 raise ImportError(msg)
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
 https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
 * The Python version is: Python3.11 from "/home/pi/Desktop/Python/tkinter/bin/python"
 * The NumPy version is: "1.26.4"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

And I just installed the mentioned lib:

ImportError: libopenblas.so.0: cannot open shared object file: No such file or directory

using this:

sudo apt-get install libcblas-dev

and found it already installed.And then I tried this:

sudo apt-get install libjasper-dev 

and it worked!So try these command may help:

sudo apt-get install libcblas-dev
sudo apt-get install libhdf5-dev
sudo apt-get install libhdf5-serial-dev
sudo apt-get install libatlas-base-dev
sudo apt-get install libjasper-dev 
sudo apt-get install libqtgui4 
sudo apt-get install libqt4-test

But actually I don't know why it works.

answered Jun 17, 2024 at 13:13
1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center. Commented Jun 18, 2024 at 21:55

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.