Raspberry pi streamlit

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
  cmake -DARROW_ARMV8_ARCH=armv8-a -DPYTHON_EXECUTABLE=/usr/bin/python3  -DPYARROW_BUILD_CUDA=off -DPYARROW_BUILD_FLIGHT=off -DPYARROW_BUILD_GANDIVA=off -DPYARROW_BUILD_DATASET=off -DPYARROW_BUILD_ORC=off -DPYARROW_BUILD_PARQUET=off -DPYARROW_BUILD_PLASMA=off -DPYARROW_BUILD_S3=off -DPYARROW_BUILD_HDFS=off -DPYARROW_USE_TENSORFLOW=off -DPYARROW_BUNDLE_ARROW_CPP=off -DPYARROW_BUNDLE_BOOST=off -DPYARROW_GENERATE_COVERAGE=off -DPYARROW_BOOST_USE_SHARED=on -DPYARROW_PARQUET_USE_SHARED=on -DCMAKE_BUILD_TYPE=release /tmp/pip-install-tzi_826c/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
aarch64

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

$ uname -m
armv7l

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

@robmarkcole okay, good to know. I’ll see if I can get my instructions to work on Ubuntu next weekend.

Hey @robmarkcole,

Good news; I got pyarrow to install on 64 bit Ubuntu 20.10. It took a lot of trial and error (and the majority of the weekend), but these steps work for me on a clean install.

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

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

# Update apt
$ sudo apt update

# Install apache arrow headers pegged at version 1.0.1-1
$ sudo apt install libarrow-dev=1.0.1-1 libarrow-python-dev=1.0.1-1
$ sudo apt-mark hold libarrow-dev libarrow-python-dev

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

For some reason, in Ubuntu, I needed to specify ARROW_HOME=/usr which I didn’t have to do in Raspberry Pi OS 64 Bit.

Another thing I noticed was that the latest arrow libraries are now at 2.0.0, whereas the version of pyarrow in pypi is still 1.0.1, so when installing the headers, I pinned them to match the version in pypi. This is a necessary step, as upgrading those packages to 2.0.0 will break your streamlit installation. :sob:

I really hope that apache arrow starts publishing wheels for aarch64 the same way numpy does. This will save a lot of people these headaches.

1 Like

@shadanan thanks for your effort on this. Unfortunately when I followed the instructions above I get error:

Failed to build pyarrow
ERROR: Could not build wheels for pyarrow which use PEP 517 and cannot be installed directly

This could be due to files hanging around from earlier efforts, I’m not sure. Nevertheless as it stands streamlit on Pi is not beginner friendly, and unfortunately it doesn’t look like the picture will improve any time soon

Hey Rob!

Great topic here!

I’m raspberry pi noob who wants to get started! :raised_hands:

Which device would you recommend buying?

Thanks,
Charly

cc: @andfanilo @okld @randyzwitch

HI @Charly_Wargnier
talking hardware the new Pi 400 looks like a great choice, not just because of the nice form factor but the also overclocked the CPU.
However as per discussion above streamlit on Pi is not beginner friendly alas

Hi, how can I solve this issue. Thanks in advance.

Pyarrow has been such a pain in the head

I have mamaged to solve the issue by running these commands using conda:

conda install pyarrow -c conda-forge
pip install streamlit
I am using Archiconda3-0.2.3-Linux-aarch64.sh
wget https://github.com/Archiconda/build-tools/releases/download/0.2.3/Archiconda3-0.2.3-Linux-aarch64.sh

Same pyarrow headaches on Jetson nano…

We finally got around to publishing a conda-forge recipe, can someone try that out and let us know if it works on Raspberry Pi? If so, we’ll add that to our docs as a recommended solution

It works!

  • Raspberry Pi 4 Model B, 2 Gb RAM,
  • A fresh SD card with 2020-08-20-raspios-buster-arm64-lite.img (I haven’t done any update of raspios because that would just be a waste of time if the Streamlit install should fail)
  • $ wget https://github.com/Archiconda/build-tools/releases/download/0.2.3/Archiconda3-0.2.3-Linux-aarch64.sh
  • $ chmod +x Archiconda3-0.2.3-Linux-aarch64.sh
  • $ ./Archiconda3-0.2.3-Linux-aarch64.sh (takes quite a while)
  • $ conda install -c conda-forge streamlit (as @randyzwitch as suggested above)
  • Streamlit installs – but does not work yet (I got AttributeError: module ‘google.protobuf.descriptor’ has no attribute '_internal_create_key when I tried to run the streamlit hello app)
  • $ conda update conda -y
  • $ pip install --upgrade protobuf (this solved: AttributeError: module ‘google.protobuf.descriptor’ …)
  • $ pip install --upgrade pip (just for good measure – most likely not required)

And now “streamlit hello” is working! (of course one has to activate the virtual environment with the command “conda activate” but I suppose that goes without saying (but now I said it anyway :wink:))

Thank you very much. This has been a stone in the shoe for me for a long time.

6 Likes

Hi everybody!

I just discovered Streamlit and it’s exactly what I need.
I would like to know if there is a way to use it on my Raspberry PI 4 that I’m using for my Home Assistant domotic system.

I tried to install with different solutions but I failed : pyarrow problem!

I also see the 1st post above about the Home Assistant add-on: is it still available ?

Many thanks. :wink:

Nice! I’m tempted!

Before I buy, is it this one?

Thanks,
Charly

1 Like

@smilorel the approach on RPi is to install Streamlit using conda.
RE Home Assistant addon I did not update it since the conda option became available, please create a PR if you get time to work on the update :slight_smile:

Hi robmarkcole,

Thanks for your answer.

I tried to follow the last instruction (see jensottos post) to install conda on my Raspberry: I failed. I have the following message :

Solving environment : failed
PackagesNotFoundError: The following packages are not available from current channels:

  • pyarrow.

Could you please tell me what’s I’m doing wrong ? :slight_smile:

English langage isn’t my mother tongue langage: I don’t know what you mean by “PR”.

Make sure you added the channel: conda install -c conda-forge streamlit

PR = Pull request

Thanks for your answer.

It doesn’t work…

=> Here I have the following error : /home/…/archiconda3/bin/python : Exec format error.