Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install keras and tensorflow using Rstudio

While trying to following the instructions of installing Keras and TensorFlow on Rstudio link https://keras.rstudio.com/index.html I get the following error. It is a work computer that is running Windows 7. I am not familiar with python, but I believe I have python 3.6 installed correctly (I am able to run simple python code in the Spyder IDE). Thanks in advance for any suggestions on how to get this working.

> install_keras()
Creating r-tensorflow conda environment for TensorFlow installation...
Solving environment: ...working... failed

CondaHTTPError: HTTP 000 CONNECTION FAILED for url 
<https://repo.continuum.io/pkgs/main/noarch/repodata.json.bz2>
 Elapsed: -

An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your 
way.
ConnectionError(MaxRetryError("HTTPSConnectionPool(host='repo.continuum.io', port=443): Max retries exceeded with url: /pkgs/main/noarch/repodata.json.bz2 (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x000000000474D860>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed',))",),)


Error: Error 1 occurred creating conda environment r-tensorflow
In addition: Warning message:
running command '"C:\Users\...\...\Local\CONTIN~1\ANACON~1\Scripts\conda.exe" "create" "--yes" "--name" "r-tensorflow" "python=3.6"' had status 1 
like image 399
Kevin Avatar asked Feb 28 '18 19:02

Kevin


People also ask

How do I install Keras and TensorFlow in Rstudio?

Run pip install tensorflow and pip install keras to install both of these libraries in python. You can test the TensorFlow installation by running import tensorflow as tf from python. If you get no errors, you are ready to proceed to the next step!

How do I load a TensorFlow in R?

follow these steps: open the cmd :] activate the r-reticulate env using conda activate r-reticulate (you may need your directory to conda directory if you did not add conda to your PATH) use : conda install -c anaconda tensorflow.

Do I need to install both TensorFlow and Keras?

It's not necessary to import all of the Keras and Tensorflow library functions. Instead, import just the function(s) you need for your project.


1 Answers

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.

like image 89
dkreeft Avatar answered Oct 09 '22 05:10

dkreeft