2

I'm using Raspberry 4 to host a web service with FastAPI. In my code, there's a dependency on Pandas. When I ran the web service, it gives me the error message below:

File "/home/pi/Projects/mouse_bot/venv/lib/python3.9/site-packages/china_idiom/__init__.py", line 36, in <module>
    from china_idiom.core import *
  File "/home/pi/Projects/mouse_bot/venv/lib/python3.9/site-packages/china_idiom/core.py", line 9, in <module>
    import pandas as pd
  File "/home/pi/Projects/mouse_bot/venv/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 "/home/pi/Projects/mouse_bot/venv/bin/python3.9"
  * The NumPy version is: "1.21.1"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was: /lib/arm-linux-gnueabihf/libm.so.6: version `GLIBC_2.29' not found (required by /home/pi/Projects/mouse_bot/venv/lib/python3.9/site-packages/numpy/core/_multiarray_umath.cpython-39-arm-linux-gnueabihf.so)

I followed the link in the error message, and ran these: sudo apt-get install libatlas-base-dev sudo apt-get install python-dev libatlas-base-dev

It still gives me the same error message.

I tried uninstalling NumPy and use apt install python3-numpy to install again, but the system just tells me NumPy doesn't exists this time.

1 Answer 1

0

You're using a version of NumPy compiled for version 2.29 of glibc, Raspberry Pi OS Buster ships with version 2.28. You cannot really upgrade glibc without upgrading your entire operating system, so you'll have to find a version of NumPy that works with 2.28, e.g. by compiling it from source or using an older version.

I tried uninstalling NumPy and use apt install python3-numpy to install again, but the system just tells me NumPy doesn't exists this time.

This shouldn't affect the version of NumPy installed in your virtual environment, it's the Python 3.7 (?) version from the system package manager.

PyPI doesn't distribute armhf versions, where did you install NumPy from?

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.