[Python] Installing pandas in a venv on raspberry pi

Discussão em 'Python' iniciado por Stack, Julho 27, 2025.

  1. Stack

    Stack Membro Participativo

    I am using Python 3.9.2 on my Raspberry Pi 3b+, and running my code in a virtual environment named venv with the following installed:

    Package Version
    ------------------ ------------
    blinker 1.7.0
    click 8.1.7
    flask 3.0.0
    importlib-metadata 7.0.0
    itsdangerous 2.1.2
    Jinja2 3.1.2
    MarkupSafe 2.1.3
    numpy 1.26.2
    pandas 2.1.3
    pip 20.3.4
    pkg-resources 0.0.0
    python-dateutil 2.8.2
    pytz 2023.3.post1
    setuptools 44.1.1
    six 1.16.0
    tzdata 2023.3
    werkzeug 3.0.1
    zipp 3.17.0


    When I try to import numpy or pandas like so:

    import numpy


    I get this error:

    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/home/me/Repositories/project/venv/lib/python3.9/site-packages/pandas/__init__.py", line 16, in <module>
    raise ImportError(
    ImportError: Unable to import required dependencies:
    numpy: Error importing numpy: you should not try to import numpy from
    its source directory; please exit the numpy source tree, and relaunch
    your python interpreter from there.


    I just don't understans how I can be in the numpy source tree, when running from root in a dir like this:

    • venv/
    • app.py

    I have tried the solutions mentioned in the post, unfortunately with no luck: Explain why numpy should not be imported from source directory

    Anyone who have tried something similar?

    Continue reading...

Compartilhe esta Página