Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

kerasR giving error

I am trying to use kerasR for deep learning in R. I am trying to reproduce the examples in the package. Trying the following code produces error:

library(kerasR)
mod <- Sequential()

The error is:

Error in Sequential() : attempt to apply non-function
like image 461
Leo Avatar asked Jun 09 '26 02:06

Leo


1 Answers

I'd suggest to look at this issue in KerasR Github repo: https://github.com/statsmaths/kerasR/issues/1

Basically you should check where is located your version of python and then use reticulate::use_python("PATH_TO_PYTHON") to tell the system where to find Python.

Watch Out!
You can load just one Python interpreter per session and the use_python() function doesn't warn you if there already is a loaded interpreter.
Moreover if you run py_config() it automatically loads the first interpreter that he finds (which, in your case, seems to be the wrong one!), thus you'd better call reticulate::use_python("PATH_TO_PYTHON") before anything else.

like image 118
NDonelli Avatar answered Jun 10 '26 18:06

NDonelli