Skip to content

Error: The h5py Python package is required to use pre-built Keras models #361

Closed
@holgerbrandl

Description

@holgerbrandl

To reproduce the issue start a docker container

docker pull rocker/tidyverse
docker run -it rocker/tidyverse /bin/bash --login

within docker prep python and install keras package in R

## prep python installation (pip, virtualenv are needed for install_keras)
wget https://bootstrap.pypa.io/get-pip.py
python3 get-pip.py

pip install virtualenv
pip install h5py

Rscript - <<"EOF"
install.packages("keras")
library(keras)
install_keras()

conv_base <- application_vgg16(weights = "imagenet", include_top = FALSE, input_shape = c(150, 150, 3))
summary(conv_base)
EOF

Which finally reports

Installation complete.

Error: The h5py Python package is required to use pre-built Keras models
Execution halted

So I've checked if the h5py package is correctly installed:

# python3
Python 3.5.3 (default, Jan 19 2017, 14:11:04) 
[GCC 6.3.0 20170118] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import h5py
/usr/local/lib/python3.5/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters

Which looks OKish. What am I doing wrong?

The issue seems related to https://stackoverflow.com/questions/46819212/error-in-r-the-h5py-python-package-is-required-to-save-and-load-models but none of the suggested workarounds seem to solve the problem

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions