Riedl's Blog

Installing Streamlit on RPi4

Published on 29 Jan 2021

Update for Raspberry Pi OS Bookworm

With the release of Raspberry Pi OS Bookworm, a virtual environment is required to install Python packages. If you try to install something outside of a virtual environment you will be met with the following error message:

pip install streamlit

error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
    python3-xyz, where xyz is the package you are trying to

This means that you must now install virtualenv with:

sudo apt install python3-virtualenv

After installing virtualenv, you can create a virtual environment and install Streamlit with:

virtualenv test
source test/bin/activate
pip install streamlit

You can also deactivate an environment with:


I have not retested this with the 32-bit version of Raspberry Pi OS but I assume it is still not compatible, as noted in my previous updates to this post.

Update as of 8/6/2022

As of 8/6/2022 I have confirmed on both the latest 64-bit Raspberry Pi OS and the 64-bit Ubuntu 20.04.2 LTS operating systems that Streamlit can now be easily installed with the most current pip version. It still seems that Streamlit is not compatible with the 32-bit version of Raspberry Pi OS.

A fresh install of the 64-bit Raspberry Pi OS was missing pip for me so I installed it with

sudo apt install python3-pip

Original Post

I recently got a Raspberry Pi 4 and the first project I want to use it for is scraping stock data. In addition, I want the Pi to run a web-based dashboard in the background so that I can monitor the scraping and data quality. I have some familiarity with Streamlit, which is a Python package that allows you to build data science web-based dashboards using Python, so I figure I should try to get that running on the Pi. For reference, I am running Ubuntu 20.04.2 LTS 64-bit on my Raspberry Pi 4. Just trying to run a pip install failed.

$ 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

This is a pretty easy error to debug. The issue is that I do not currently have cmake installed. This is easily remedied by running:

sudo apt install cmake

Trying to run a pip install fails again this time with a more cryptic error.

$ pip install streamlit
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
-- Could NOT find Arrow (missing: Arrow_DIR)
CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
  Could NOT find Arrow (missing: ARROW_INCLUDE_DIR ARROW_LIB_DIR
Call Stack (most recent call first):
  /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
  cmake_modules/FindArrow.cmake:419 (find_package_handle_standard_args)
  cmake_modules/FindArrowPython.cmake:46 (find_package)
  CMakeLists.txt:214 (find_package)

-- Configuring incomplete, errors occurred!
See also "/tmp/pip-install-ukwvzvq3/pyarrow_e3f093a86d3542b987b698c48bfa3ebe/build/temp.linux-aarch64-3.8/CMakeFiles/CMakeOutput.log".
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

After some searching I came across this discussion on the Streamlit site https://discuss.streamlit.io/t/raspberry-pi-streamlit/2900/35. Some people solved it by switching to Archiconda but I want to stick with using virtualenvs. One of the suggestions in the post I got to work but needs some modification. Running the following finally works (note: the original commands no longer work and I have updated them appropriately):

# !!! Apparently these commands no longer work !!!
wget https://apache.bintray.com/arrow/ubuntu/apache-arrow-archive-keyring-latest-focal.deb
sudo apt install ./apache-arrow-archive-keyring-latest-focal.deb

# !!! Try these instead !!!
sudo apt install ca-certificates lsb-release
wget https://apache.jfrog.io/artifactory/arrow/$(lsb_release --id --short | tr 'A-Z' 'a-z')/apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb
sudo apt install ./apache-arrow-apt-source-latest-focal.deb

sudo apt update

sudo apt install libarrow-dev libarrow-python-dev

ARROW_HOME=/usr PYARROW_CMAKE_OPTIONS="-DARROW_ARMV8_ARCH=armv8-a" pip install streamlit

After completing the install I can run the included Streamlit demo:

streamlit hello

Hopefully this helps someone else who gets stuck!


  1. Streamlit will not work on 32-bit operating systems. I have tried debugging this a couple of times and was not able to get it working.
  2. The source location for Apache Arrow has changed a couple of times. I believe the commands above are currently working for Ubuntu (I think you may need to make a small modification for Raspberry Pi OS). I left the legacy commands for reference.
  3. As of now if you update pip to the latest version, you can install Streamlit without issue from pip.