keras depends on tensorflow which depends on reticulate, but if you just have the CRAN version of reticulate installed, you get the following error message:
namespace ‘reticulate’ 1.8 is being loaded, but >= 1.8.0.9002 is required
ERROR: lazy loading failed for package ‘tensorflow’
* removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/tensorflow’
Installation failed: Command failed (1)
update.packages('reticulate') doesn't solve it because the latest on CRAN right now is 1.8.0.
Sorry I didn't open a pull request, I tried to find the underlying Rmd doc. that generated the main page but didn't succeed . Thanks!
It's right here: https://keras.rstudio.com/#installation
We currently instruct people to install with devtools::install_github("rstudio/keras"). This will automatically cause reticulate to also be installed from GitHub (due to this in the description: https://github.com/rstudio/keras/blob/master/DESCRIPTION#L28).
Let us know if this is not working as intended for you.
I am running into the same issue as @setgree, using devtools::install_github("rstudio/keras"). The install from github worked fine 2 days ago. All of a sudden today it has stopped working. I'll dig into it a bit and see if I can fix locally...
Further update: The only way I can get a successful install of the keras package is to install reticulate, then tensorflow, then keras, all via install_github(), in that order. BTW I am doing this in a clean docker container, from image rocker/r-ver:3.5.0, with the tf/keras dependencies (e.g., python, pip, etc.) installed first.
I just made a change to the keras DESCRIPTION file to explicitly require the development version of reticulate. I have verified that this works w/ install_github (after removing TF, keras, and reticulate). Hopefully this works for you as well!
I am still getting a failed install. Here's a dockerfile that replicates the problem:
https://gist.github.com/scottcame/5cbab4725b11a240e9373a705a880b3f
Uncommenting the explicit github install of reticulate and tensorflow results in a successful install of keras.
FYI, I tried doing the image build in play-with-docker, and it stalls out...probably too much to download and install.
But you can replicate locally by creating a new, empty directory somewhere and:
curl -s https://gist.githubusercontent.com/scottcame/5cbab4725b11a240e9373a705a880b3f/raw/3d951a5744b54006600ce5bbbbf7432d1c23a478/Dockerfile | docker build -t r-keras-tmp -f - .
Hi all, thanks for checking in on it @jjallaire. Indeed when I used devtools::install_github("rstudio/keras"), this was unsuccessful at installing the dev. version of retiuclate. It looks like this commmit (https://github.com/rstudio/keras/commit/1488ef8ce44958705ac7c6a8e8b618b073c31f93#diff-35ba4a2677442e210c23a00a5601aba3) is intended to address this, thanks for looking into it!
Maybe you are running an older version of devtools that doesn't respect the Remotes entry in the DESCRIPTION file? (although this was added 2+ years ago).
Looks like the docker image has devtools 1.13.6...the current CRAN version
Okay, I just changed the DESCRIPTION to point to the CRAN version rather than dev versions (the dev versions are there for a bugfix but if this prevents installation on some systems it's not worth it). I have no idea why the Remotes field is not being respected here.
Thanks, this works flawlessly now!
Confirmed...the dockerfile in my gist linked above now results in a successful keras package install. Thanks!