[Python] Illegal instruction (core dumped) when running Streamlit app on Raspberry Pi 4

Discussão em 'Python' iniciado por Stack, Agosto 26, 2025.

  1. Stack

    Stack Membro Participativo

    I’m trying to run a small Streamlit app on my Raspberry Pi 4. For testing, i made a small version with just core functionality:

    # main.py
    import pandas as pd
    import streamlit as st

    def main():
    st.title("My Streamlit App")
    st.write("Hello, world!")

    df = pd.DataFrame({
    'Column 1': [1, 2, 3],
    'Column 2': ['A', 'B', 'C']
    })
    st.write("Here's a sample DataFrame:")
    st.dataframe(df)

    if __name__ == "__main__":
    main()


    On the raspberry, create a virtual environment, install Streamlit and run the app:

    python3 -m venv .venv
    source .venv/bin/activate
    pip install streamlit
    streamlit run main.py

    Problem


    When I try to run the app on the Pi 4, i get :

    Illegal instruction (core dumped)


    Sometimes even just doing:

    python3 -c "import pandas"


    inside the container causes the same crash. This happens both with my real app and with the minimal test app above.

    What I tried


    1. Installing pandas via pip install pandas inside the container → still crashes with 132 Illegal instruction.


    2. Installing python3-pandas via apt-get works, but since i installed streamlit via pip, i get a module not found: pandas error.


    3. Adjusted a Dockerfile to install system dependencies (libatlas-base-dev, gfortran, build-essential, etc.) before pip install. Still crashes.


    4. Forced pip to use piwheels.org (pip config set global.extra-index-url https://www.piwheels.org/simple). Still crashes.


    5. Tried both approaches:
      • Debian packages (apt-get install python3-pandas) while leaving pandas out of requirements.txt. Still crashes.
      • Forcing source builds (pip install --no-binary=:all: pandas numpy) Installation failed.
    Question


    Has anyone successfully run a Streamlit app with pandas on a Raspberry Pi 4? What’s the correct way to install pandas (and numpy) so that it doesn’t pull in incompatible wheels with unsupported CPU instructions?

    Any working example for Streamlit + pandas on Raspberry Pi 4 would be greatly appreciated.

    If you need any more information, just reach out.

    Thanks in advance!

    Continue reading...

Compartilhe esta Página