Raspberry pi streamlit

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?

@robmarkcole, these instructions worked for me on a fresh install of 64 bit Raspberry Pi OS.

Are you using 64 bit Raspberry Pi OS? This is not the default. You can check with:

$ uname -m

If you’re on 32 bit, you’ll see something like this:

$ uname -m

If you are on 32 bit, then you have to change PYARROW_CMAKE_OPTIONS="-DARROW_ARMV8_ARCH=armv8-a" to something else, but I’m not exactly sure what. I tried digging in to the Apache Arrow’s cmake files, but without much success. In any case, I won’t be able to test anything I come up with because I’m not running 32 bit. If you can figure it out, that would make everyone’s lives easier.

If you are on 64 bit and my instructions didn’t work, let me know. Maybe I forgot something. I have an extra SSD lying around and I might have time to try and repro my steps next weekend.

@shadanan my apologies I should have clarified this was on 64 bit Ubuntu on pi, Ubuntu Desktop 20.10 to be precise