2

I use raspberrypi 4 ; 32 bit, linux run python

error occur:

ImportError: Unable to import required dependencies: numpy

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


I find the solution link: https://github.com/numpy/numpy/issues/15090

I haven't solve yet.

below I did Try uninstalling and reinstalling numpy to solve

joy@raspberrypi:/ $ python --version
Python 3.9.2
joy@raspberrypi:/ $ python3 --version
Python 3.9.2

joy@raspberrypi:/media/joy/DATA $ pip uninstall numpy
Found existing installation: numpy 1.19.5
Not uninstalling numpy at /usr/lib/python3/dist-packages, outside environment /usr
Can't uninstall 'numpy'. No files were found to uninstall.
joy@raspberrypi:/media/joy/DATA $ pip install --upgrade numpy
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: numpy in /usr/lib/python3/dist-packages (1.19.5)
Collecting numpy
  Using cached https://www.piwheels.org/simple/numpy/numpy-1.23.4-cp39-cp39-linux_armv7l.whl (12.4 MB)
Installing collected packages: numpy
  WARNING: The scripts f2py, f2py3 and f2py3.9 are installed in '/home/joy/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed numpy-1.23.4
  • but when I run python script with importpandas and pymongo (the main correct script) still cannot run, somewhere setting inside raspberrypi is wired I assume
Traceback (most recent call last):
  File "/media/joy/DATA/excel_to_mDB.py", line 3, in <module>
    import pandas as pd
  File "/home/joy/.local/lib/python3.9/site-packages/pandas/__init__.py", line 16, in <module>
    raise ImportError(
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 "/usr/bin/python"
  * The NumPy version is: "1.23.4"

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

in case someone want to see the whole script( code is correct, that I can run on normal linux computer, just have some setting error on raspberry pi 4)

import pandas as pd
from pymongo import MongoClient

aaa = pd.read_excel("T1_new.xls")

print(aaa.head)

client = MongoClient('127.0.0.1:27017')
db = client['sample_data_in_DB']
collection = db['sample_collection']

collection.insert_many(aaa.to_dict('records'))
5
  • This "question" is uncannily similar to raspberrypi.stackexchange.com/q/139679/8697
    – Milliways
    Commented Oct 26, 2022 at 8:42
  • that publisher is my classmate in the same raspberrypi course, and foundation question is different that mine is stock on import error, and she doesn't have it. Seems similar cause we teaches by the same teacher, but again, I have to deal with myself, and question ask about what is different, I'm glad to join this big family
    – 44 chuang
    Commented Oct 26, 2022 at 8:55
  • Both of you should be looking at a better teacher
    – Milliways
    Commented Oct 26, 2022 at 8:57
  • haha, I tried to learn on YT now, I'm 3 month on python learner, and 3 day of raspberrypi freshman. Everything has a start even my mistake looks stupid in the first time. Thanks for ur advice, if u have any more idea just let me know
    – 44 chuang
    Commented Oct 26, 2022 at 9:02
  • If you want help See Tour to see how this site works and How do I ask a good question?
    – Milliways
    Commented Oct 26, 2022 at 10:37

1 Answer 1

2

It seems a required package for numpy doesn't get installed by default. I was able to get my #import numpy command to succeed on my RPI Zero on Python 3.9 by installing this package: sudo apt-get install libatlas-base-dev. That package seems to include the missing libcblas.so.3 that is causing your script to fail. FYI: this was blocking me from using numpy, which was blocking pandas which was blocking plotly.

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.