Solving R crash while loading keras dataset in centos 7

   After installing the keras and tensorflow packages in centos 7 Linux, R has crashed while loading keras dataset, and I fixed the problem as described below.

> library(keras)
> install_keras()

> dataset=dataset_boston_housing()
/root/.virtualenvs/r-tensorflow/lib/python2.7/site-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
Using TensorFlow backend.


 *** caught illegal operation ***
address 0x7f016fe93fd0, cause 'illegal operand'

Traceback:
 1: .Call(`_reticulate_py_module_import`, module, convert)
 2: py_module_import(module, convert = convert)
 3: import(module)
 4: doTryCatch(return(expr), name, parentenv, handler)
 5: tryCatchOne(expr, names, parentenv, handlers[[1L]])
 6: tryCatchList(expr, classes, parentenv, handlers)
 7: tryCatch(import(module), error = clear_error_handler())
 8: py_resolve_module_proxy(x)
 9: `$.python.builtin.module`(keras, datasets)
10: keras$datasets
11: dataset_boston_housing()


Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Selection:




After searching the problem, I found below command to fix it.

> install_keras(tensorflow = "1.5")
Using existing virtualenv at  ~/.virtualenvs/r-tensorflow
Upgrading pip ...

 .....

After the installation has finished, I can load the dataset.

> library(keras)> dataset=dataset_boston_housing()
/root/.virtualenvs/r-tensorflow/lib/python2.7/site-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
Using TensorFlow backend.
> head(dataset)
$train
$train$x
           [,1]  [,2]  [,3] [,4]   [,5]  [,6]  [,7]    [,8] [,9] [,10] [,11]
  [1,]  1.23247   0.0  8.14    0 0.5380 6.142  91.7  3.9769    4   307  21.0
  [2,]  0.02177  82.5  2.03    0 0.4150 7.610  15.7  6.2700    2   348  14.7
  [3,]  4.89822   0.0 18.10    0 0.6310 4.970 100.0  1.3325   24   666  20.2
  [4,]  0.03961   0.0  5.19    0 0.5150 6.037  34.5  5.9853    5   224  20.2
  [5,]  3.69311   0.0 18.10    0 0.7130 6.376  88.4  2.5671   24   666  20.2

   .....


That is it! Thanks for reading!

No comments:

Post a Comment