6

I recently purchased a Raspberry Pi 4 Model B and after a week I have accomplished nothing because I can't get TensorFlow installed.

Hoping someone can PLEASE help me.

My error message:

E tensorflow/core/platform/hadoop/hadoop_file_system.cc:132] HadoopFileSystem load error: libhdfs.so: cannot open shared object file: No such file or directory

I thought I found the solution from the link below but it didn't solve my issue:

Error Installing Tensorflow in Raspberry Pi 4

(newenv) pi@raspberrypi:/newenv $ python3 
Python 3.7.3 (default, Apr  3 2019, 05:39:12) 
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
2020-01-19 13:55:24.896587: E tensorflow/core/platform/hadoop/hadoop_file_system.cc:132] HadoopFileSystem load error: libhdfs.so: cannot open shared object file: No such file or directory

Does anyone know how to resolve this issue?
I have reinstalled NOOBS 3 times to start "fresh" after tinkering with all of the online solutions...

Update: Instead of using NOOBS I used Raspian Buster with desktop and recommended software. Same Hadoop error message.

Thanks.

user2607686
  • 61
  • 1
  • 1
  • 4

1 Answers1

10

Hey I recently figured this out. Here's a YouTube video I made giving the step-by-step: https://youtu.be/GNRg2P8Vqqs

Installing Tensorflow requires some extra steps on the Pi's ARM architecture.

This is how I installed tf on my Pi 4: Make your project directory:

cd Desktop
mkdir tf_pi
cd tf_pi

Make a virtual environment:

python3 -m pip install virtualenv
virtualenv env
source env/bin/activate

Run the commands based on https://github.com/PINTO0309/Tensorflow-bin/#usage:

sudo apt-get install -y libhdf5-dev libc-ares-dev libeigen3-dev
python3 -m pip install keras_applications==1.0.8 --no-deps
python3 -m pip install keras_preprocessing==1.1.0 --no-deps
python3 -m pip install h5py==2.9.0
sudo apt-get install -y openmpi-bin libopenmpi-dev
sudo apt-get install -y libatlas-base-dev
python3 -m pip install -U six wheel mock

Pick a tensorflow release from https://github.com/lhelontra/tensorflow-on-arm/releases (I picked 2.0.0). Picking a higher version of Tensorflow (like 2.1.0) requires a higher version of scipy that wasn't compatible with my Raspberry Pi:

wget https://github.com/lhelontra/tensorflow-on-arm/releases/download/v2.0.0/tensorflow-2.0.0-cp37-none-linux_armv7l.whl
python3 -m pip uninstall tensorflow
python3 -m pip install tensorflow-2.0.0-cp37-none-linux_armv7l.whl

RESTART YOUR TERMINAL

Reactivate your virtual environment:

cd Desktop
cd tf_pi
source env/bin/activate

Test: Open a python interpreter by executing:

python3 
import tensorflow
tensorflow.__version__

This should have no errors and output: 2.0.0

Sam
  • 101
  • 7