none
R - Error when running Keras Remotely RRS feed

  • Question

  • I have a Keras machine learning model that I would like to operationalize. I found and have been following this excellent article: https://blogs.msdn.microsoft.com/mlserver/2018/05/25/how-to-operationalize-keras-models-in-microsoft-machine-learning-server/. However, I'm running into the following error ONLY when running my code remotely:

    Error in load_mode_hdf5(tmp, custom_objects = custom_objects, compile = compile): The h5py Python package is required to save and load models.

    If I run the code in RStudio (on the Microsoft Machine Learning Server) or in RGui, the code runs fine.

    I've narrowed down the problem to one line. The following output demonstrates it:

    > remoteLogin("http://localhost:12800", session=TRUE, username="redacted", password="redacted!")
    Diff report between local and remote R sessions...

    Local and Remote R versions are the same: R version 3.4.3 (2017-11-30)


    Your REMOTE R session is now active.
    Commands:  
            - pause() to switch to local session & leave remote session on hold.
            - resume() to return to remote session.
            - exit to leave (and terminate) remote session.

    REMOTE> mlpKerasDecayCost <- readRDS("G:\\ODResearch\\mlpKerasDecayCost-0.2.rds")
    REMOTE> uModel <- keras::unserialize_model(mlpKerasDecayCost$finalModel$object)
    Error in load_model_hdf5(tmp, custom_objects = custom_objects, compile = compile) : 
      The h5py Python package is required to save and load models
    REMOTE> 

    As it states, the Remote and local R instances are synced up. However, it appears that the problem is with Python (required by Keras). How do I fix the remote Python install? I don't understand why it wouldn't have the h5py package, but the local does, even though it is all the same computer.

    Tuesday, January 22, 2019 8:20 PM

All replies

  • Even though the local and remote R version might be the same, the packages installed might not be, right? Could you log in into the server and check the Python version and packages?
    Wednesday, January 23, 2019 1:13 AM
    Owner