Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to solve ImportError: libhdf5_serial.so.103: cannot open shared object file: No such file or directory while Importing h5py

I am fairly new to the Linux Platform and the Raspberry Pi. I am basically doing an ML Project with Tensorflow. So for saving the model, I am using the h5py library. Although I had no problems installing the library, I had a huge Import Error when importing it in Python 3.7

I used this to download pip3 install h5py

This is the Import Error it showed after I ran the code - File "<stdin>", line 1, in <module> File "/home/pi/.local/lib/python3.7/site-packages/h5py/__init__.py", line 26, in <module> from . import _errors ImportError: libhdf5_serial.so.103: cannot open shared object file: No such file or directory So after seeing this error I searched a lot on the internet but nothing worked for me. I tried this, this, this and even this.

I also installed sudo apt-get update sudo apt-get install libhdf5-dev sudo apt-get update sudo apt-get install libhdf5-serial-dev

But nothing seems to work. What should I do??

Btw, I used the Raspberry Pi 3B+, Python 3.7 and Raspbian.

like image 768
HemeshCh Avatar asked Jan 24 '23 23:01

HemeshCh


1 Answers

I had a similar problem when installing numpy on a raspberry pi zero w I could solve by

  1. uninstall the library in pip
  2. install the library with apt-get: sudo apt-get install python3-h5py

It seems like just installing the library using apt-get without uninstalling it priorly doesn't work.

like image 83
mlx11 Avatar answered Jan 28 '23 13:01

mlx11