Install keras and tensorflow using Rstudio Install keras and tensorflow using Rstudio windows windows

Install keras and tensorflow using Rstudio


Installing Keras and TensorFlow using install_keras() isn't required to use the Keras R package. You can do a custom installation of Keras (and desired backend) as described on the Keras website and the Keras R package will find and use that version.

Source

So you can circumvent this issue with the firewall using a custom installation. The R package keras will then find that installation automatically. See the linked source for more information on how to do a custom installation.

edit: btw, there is a similar question that has been answered here. That poster goes into changing the proxy settings to cicrumvent the firewall. I cannot mark this question as a duplicate due to active bounty.


I suggest you first update your conda in terminal:

conda update --all

Then run the following commands in R:

install.packages("tensorflow")library(keras)to_categorical(0:3)

You could also test the followings if you get any error at the time of installing tensorflow and keras:

install.packages("tensorflow")install.packages("keras")install_keras()install_tensorflow() 


There is a good answer here:

https://github.com/rstudio/keras/issues/649

(scroll down to the answer by skeydan)

Here is the answer:

First install tensorflow directly from GitHub, as in

devtools::install_github("rstudio/tensorflow")devtools::install_github("rstudio/keras")

Then do

tensorflow::install_tensorflow()tensorflow::tf_config()

which should give you version 1.12.

We have been installing TF 1.10 until yesterday because of a bug in that will only be fixed in TF 1.13 (which should be out anytime but unfortunately isn't yet). Now with people having installation problems due to incompatibilities with numpy as installed by conda, we decided to switch to TF 1.12 now and as soon as TF 1.13 is actually available, we'll install that by default.

If you still run into problems installing, please open another issue and describe the problem, indicating the output of

reticulate::py_discover_config()reticulate::use_condaenv("r-tensorflow")reticulate::py_config()

Thanks!