[solved] Input/Output Error(Error no. 5): 'Unable to open file (file read failed: time = __ , filename = __, file descriptor = _, errno = 5, error message = 'Input/output error'.....'

Sometimes I get this error while working on TensorFlow models or h5py.

Actually, this happens when HDF5 is used externally or internally and the file you are trying to access gets locked by HDF5.

We can fix it by disabling HDF5 File Locking by overriding the environment variable ‘HDF5_USE_FILE_LOCKING’ by-

import os
os.environ[“HDF5_USE_FILE_LOCKING”] = “FALSE”

Don’t forget to restart the kernel after that.

Note- Include this code before loading the model or file. It is recommended to include this at the start of the code/jupyter notebook to avoid any errors.

Hii Shubh,
I’m still getting this OS error.

Hi Divya,

Make sure you follow the steps mentioned above and restart the kernel after including the code. If the issue still persists, please share the screenshot of the error.