5

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.

8
  • 1
    Have you tested this one? Worked?
    – M. Rostami
    Jan 19 '20 at 21:13
  • Or this one: raspberrypi.stackexchange.com/questions/106917/….
    – tlfong01
    Jan 20 '20 at 0:59
  • I am a little bit confused. It appears that you are trying to import tensorFlow in a python 3.7.3 shell. But have you successfully installed tensorFlow earlier? The links you and me referred are about tensorFlow installation problems and two examples on how to solve the problems and finally successfully installed tensorFlow. In other words, you must first successfully install tensorFlow, BEFORE you can start a python shell and import the tensorFlow module.
    – tlfong01
    Jan 20 '20 at 2:36
  • This is what I have done. 1) I reinstalled NOOBS. 2) Then I downloaded tensorflow using this command sudo pip3 install tensorflow (from piwheels.org/project/tensorflow) from the command window. It downloaded without any errors. 3) I type in Python3 to get the Python shell then type in import tensorflow and I get the following 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 Jan 22 '20 at 2:21
  • @M.Rostami I searched my files and I don't even have a libhdfs.so How can I not have it? Shouldn't it be installed when I download Tensorflow. Hmmm. Thanks!! Jan 22 '20 at 2:49
9

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

1
  • Thank you so much!! Feb 6 '20 at 1:17

Not the answer you're looking for? Browse other questions tagged or ask your own question.