Problem loading hdf5 keras model in


I created an R Shiny app which uses an existing hdf5 keras model, built seperatly. Locally it works well. The app also works on except for the import of the hdf5 model, by looking at the log, it crashes when important the model, here is the error message:

"Error in load_model_hdf5: The h5py Python package is required to save and load models"

I created locally a python environment which includes all needed packages: tensorflow, keras, h5py etc. I also indicated in the .Rprofile file that reticulate package must point to this python environment. When deploying the app in, I do not import the python environnement of course. I am sure the shinyapps loads keras package because the code does not crash at this step. Does anyone already had this problem ?

Many thanks in advance,


I have exactly the same issue. Can't find a solution out there. I hit your question here.

At first I didn't setup the Rprofile and it was throwing me a bunch of errors, but following some tips I corrected it. Now I get the same error message.

While trying some solutions in the past 4 days I really messed with my R/CONDA/Python Reticulate system and needed to reinstall everything...

Do you happen to find the solution yourself?


Hi @pdavid,

Thank you for your answer. I had the same kind of troubles with my system, doing .Rprofile and doing uninstall-reinstall python environment operations..

I did not find the solution yet, I think I will enhance my skills in Docker combined with a AWS Linux system with EC2 and try to host my app that way.

Please let me know if you find a better solution with shinyapps, thanks.


1 Like