Raspberry pi streamlit


First time posting to the streamlit discussions. I’ve also been trying to install streamlit on a raspi4b and running into an issue compiling pyarrow. I’m on a 64bit ubuntu with an armv8/aarch64 cpu. It looks like the architecture flag for gcc -march=armv8-a is being rejected by the compiler for some reason. I don’t know enough to go any further in debugging this issue. I hope this helps!

I would also like to get streamlit running on my pi.


I’m hitting the same problem!
I tried several versions of pyarrow (0.9.0, 0.10.0, 0.17.1, 1.0.0) but I wasn’t able to install any of them unfortunately.

Is there a workaround other than downgrading streamlit?

Maybe try using miniconda as your build environment? If you can do conda install pyarrow and get a successful install, you can run pip install streamlit after and hopefully get a better result.

Otherwise, not sure what a temporary fix might be. Downgrading works for the short-term, but we are looking to move more of our functionality to Arrow, so we should find a more reasonable solution

1 Like

Unfortunately it does not work

pyarrow is on conda-forge

conda install -c conda-forge pyarrow

1 Like

Just ran in to this bug while trying to install streamlit to my Raspberry Pi 4. Basically, I can’t seem to get pyarrow installed. Installing streamlit==0.62.0 works as a workaround for now.

This is a problem with pyarrow on arm7l, not with streamlit, but here’s the relevant error messages from the log, which will help people that are googling.

  -- Could NOT find Arrow (missing: Arrow_DIR)
  -- Checking for module 'arrow'
  --   No package 'arrow' found
  CMake Error at /usr/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
    Could NOT find Arrow (missing: ARROW_INCLUDE_DIR ARROW_LIB_DIR
  Call Stack (most recent call first):
    /usr/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
    cmake_modules/FindArrow.cmake:412 (find_package_handle_standard_args)
    cmake_modules/FindArrowPython.cmake:46 (find_package)
    CMakeLists.txt:210 (find_package)

  -- Configuring incomplete, errors occurred!
  See also "/tmp/pip-install-d22ajzwt/pyarrow/build/temp.linux-armv7l-3.7/CMakeFiles/CMakeOutput.log".
  error: command 'cmake' failed with exit status 1

  Failed building wheel for pyarrow

I tried using conda from @randyzwitch latest comment, but it doesn’t work:

$ conda install -c conda-forge pyarrow
Fetching package metadata: ........
Error: No packages found in current linux-armv7l channels matching: pyarrow

Did you mean one of these?

    arrow, pyrr

You can search for this package on anaconda.org with

    anaconda search -t conda pyarrow

You may need to install the anaconda-client command line client with

    conda install anaconda-client 

While googling around, I stumbled across https://issues.apache.org/jira/browse/ARROW-9791 which might be relevant.

Hey @shadanan, welcome to the Streamlit community! Thanks for doing the research, hopefully the Arrow community can start supporting this some time in the future :crossed_fingers:

I finally got streamlit working on my Raspberry Pi 4. Unfortunately, this turned out to be a lot of work. I will provide as much guidance as possible, but I’m un-inclined to try and do a full tutorial write-up because I don’t want to accidentally break my install.

Here are the steps I used:

  1. Prepare your LD_LIBRARY_PATH. You’ll want to put this in .bashrc or .zshrc.

    $ export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
  2. Install llvm-10 from source – unfortunately, arrow requires llvm-10 at a minimum and the latest llvm in the raspbian package repos was llvm-9. If you can get llvm-10 in some other way, do it that way instead of this. It took a whole night to build llvm-10 on my poor Raspberry Pi.

    $ git clone https://github.com/llvm/llvm-project.git
    $ cd llvm-project
    $ git fetch --tags
    $ git checkout llvmorg-10.0.1
    $ mkdir build
    $ cd build
    $ cmake -G "Unix Makefiles" \
        -DLLVM_ENABLE_PROJECTS="clang;libcxx;libcxxabi" \
    $ make -j4
    $ sudo make install
  3. Install Apache Arrow from source. I adapted instructions from here: https://gist.github.com/heavyinfo/04e1326bb9bed9cecb19c2d603c8d521

    $ wget https://github.com/apache/arrow/archive/apache-arrow-1.0.1.tar.gz
    $ tar xzf apache-arrow-1.0.1.tar.gz
    $ cd arrow-apache-arrow-1.0.1/cpp
    $ mkdir build
    $ cd build
    $ export ARROW_HOME=/usr/local
    $ cmake \
        -DARROW_WITH_BZ2=ON \
        -DARROW_WITH_LZ4=ON \
    $ make -j4
    $ sudo make install
    $ cd ../../python
    $ python3 setup.py build_ext --build-type=release --with-parquet
    $ sudo python3 setup.py install
  4. Install streamlit.

    $ sudo pip3 install streamlit
  5. Run streamlit as follows. You can also put the LD_PRELOAD in your .bashrc or .zshrc. I think there’s a way to avoid having this, but it looked like I’d have to rebuild either llvm-10 or arrow, and I didn’t want to spend any more time on this.

    $ LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/libatomic.so.1.2.0 streamlit run <python_script.py>

If someone else goes through this and can simplify these steps, I’m sure the community would appreciate it.

1 Like

@shadanan good effort finding a solution. @randyzwitch this could be wrapped up as an official docker image, created on each release of streamlit?

It’s not a bad idea to have this available @robmarkcole, but also not sure 1) it needs to be for each release and 2) it needs to be maintained by Streamlit.

From my brief reading above, it looks like it’s instructions about how to compile Arrow, which will be relatively separate from different Streamlit versions. So maybe someone could write a blog post and make a Dockerfile, and then it will exist for the community to maintain?

I verified this solution and it works with LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/libatomic.so.1.2.0 so it could be posted on a blog :slight_smile:

1 Like

I think i may have found a very easy workaround:

PYARROW_CMAKE_OPTIONS="-DARROW_ARMV8_ARCH=armv8-a" pip3 install streamlit

Just passing the correct flag along to the arrow cmake.

Building llvm or arrow from source (separately from pip) is not needed.

1 Like

I would love if just it where that simple. I have however not been able to install Streamlit this way on a fresh install of 2020-08-20-raspios-buster-armhf-lite (Debian 10, “Buster”) on a Raspberry Pi 4 Model B, 2 Gb RAM.
Just to eliminate that source of error I did not install any virtual Python environment.
Still, I got his error:
Traceback (most recent call last):

 File "/home/pi/.local/bin/cmake", line 6, in <module>
   from cmake import cmake

ModuleNotFoundError: No module named ‘cmake’
error: command ‘cmake’ failed with exit status 1

The fun thing, though, is that if I just go to Python (Python 3.7.3) I have no trouble importing cmake from cmake.

1 Like

I decided to upgrade to a USB SSD from my old SD card, and did a clean install of 2020-08-20-raspios-buster-arm64-lite.

I decided to give @tshoem’s workaround a try since armv8-a refers to 64 bit arm. Unfortunately, it didn’t work. The build fails with:

    -- Could NOT find Arrow (missing: Arrow_DIR)
    -- Checking for module 'arrow'
    --   No package 'arrow' found

I think the solution would have worked if it weren’t for this bug: https://issues.apache.org/jira/browse/ARROW-9791

After that bug is resolved, we can likely build pyarrow with:

  pip install pyarrow
1 Like

I found an easier way to get streamlit installed using @tshoem’s workaround and the Apach Arrow package repository! This is for 64 bit Raspberry Pi OS.

# Download the package repo keyring
$ wget https://apache.bintray.com/arrow/debian/apache-arrow-archive-keyring-latest-buster.deb

# Install it
$ sudo apt install ./apache-arrow-archive-keyring-latest-buster.deb

# Update apt
$ sudo apt update

# Install apache arrow headers
$ sudo apt install libarrow-dev
$ sudo apt install libarrow-python-dev

# Install streamlit
$ PYARROW_CMAKE_OPTIONS="-DARROW_ARMV8_ARCH=armv8-a" pip install streamlit

@shadanan I am looking forward to getting back to the UK and trying out this solution. IMO the combo of vscode & streamlit on a Pi4 makes for a very viable platform for developing and deploying kiosk type apps, and it would be fantastic to create a demo solution and contribute that the streamlit docs or example repos. Any thoughts @randyzwitch ?

We’re re-organizing the docs to make tutorials more prominent, would love to add this :+1:

1 Like

Second that (it worked for me, on a very recent update of Raspbian 32 bit)
I don’t blog but I cross-posted at:

It is a substantial build:
disk space to build: ~ 5.6 GB for llvm, ~0.6 GB for arrow
disk space of the install: ~ 0.7 GB

Because I had installed some of the Python packages previously (Cython, most specifically) as the pi user, but not with sudo, I had to re-install those packages using sudo for the last step:

sudo python setup.py install

So a huge thank you to @ shadanan, because I had been struggling to get a different python package fully installed (PyMedPhys) which had a dependency on streamlit (which had a dependency on arrow). I attributed the answer to shadanan at the streamlit forum… I hope that’s the right way to do things.

1 Like

Might it be worth reaching out over at https://github.com/imrehg/arm-wheels to see if pyarrow can have an arm wheel created using their procedure?

1 Like

@shadanan tried your approach on a Pi4 and it fails at the final step:

PYARROW_CMAKE_OPTIONS="-DARROW_ARMV8_ARCH=armv8-a" pip install streamlit
  -- Running cmake for pyarrow
  error: command 'cmake' failed with exit status 1
  ERROR: Failed building wheel for pyarrow
Failed to build pyarrow
ERROR: Could not build wheels for pyarrow which use PEP 517 and cannot be installed directly 

are there any additional steps?