[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”

Note- Include this code before loading the model.