Laurent
Laurent

Reputation: 449

How to update Python version in r-reticulate for TensorFlow under R

I installed TensorFlow 2.2.0, Keras 2.3.0 and Reticulate 1.16 under R.

But I have still this error when I use TensorFlow: Error: Installation of TensorFlow not found. I believe it is from Python 3.6 installed with TensorFlow. How to update Python version in r-reticulate?

> library(tensorflow)
> library(reticulate)
> use_condaenv("r-reticulate", required = TRUE)
> py_discover_config("tensorflow")
python:         C:/Users/Mezeix/AppData/Local/r-miniconda/envs/r-reticulate/python.exe
libpython:      C:/Users/Mezeix/AppData/Local/r-miniconda/envs/r-reticulate/python36.dll
pythonhome:     C:/Users/Mezeix/AppData/Local/r-miniconda/envs/r-reticulate
version:        3.6.10 |Anaconda, Inc.| (default, May  7 2020, 19:46:08) [MSC v.1916 64 bit (AMD64)]
Architecture:   64bit
numpy:          C:/Users/Mezeix/AppData/Local/r-miniconda/envs/r-reticulate/Lib/site-packages/numpy
numpy_version:  1.19.1
tensorflow:     C:\Users\Mezeix\AppData\Local\R-MINI~1\envs\R-RETI~1\lib\site-packages\tensorflow\__init__.p

> tf$constant("Hellow Tensorflow")
Error: Installation of TensorFlow not found.

Python environments searched for 'tensorflow' package:
 C:\Users\Mezeix\AppData\Local\r-miniconda\envs\r-reticulate\python.exe

You can install TensorFlow using the install_tensorflow() function.

Upvotes: 1

Views: 900

Answers (2)

user11530462
user11530462

Reputation:

install.packages("tensorflow")#install the tensorflow R package from GitHub 

library(tensorflow)
install_tensorflow()#missed step

library(tensorflow)
tf$constant("Hellow Tensorflow")

For more details visit - https://tensorflow.rstudio.com/installation/

Upvotes: 1

Gautamrk
Gautamrk

Reputation: 1244

Try:

library(tensorflow)

install_tensorflow()

Then:

library(tensorflow)

tf$constant("Hellow Tensorflow")

work?

Upvotes: 0

Related Questions