Problem with Python PATH (3.6 instead of 3.8) in R for Tensorflow/Keras used

I installed Annaconda, tensorflow ans Keras and Python version is 3.8.5.

But after installing R and the 2 packages Tensorflow and Keras I always got Python 3.6. So Keras/TensorFlow does not work and I cannot run models as illustrated after. I uninstalled, reinstalled, changed the way to perform and always I got 3.6 in libpython. How to do to get Python 3.8 in R ?

I installed in the following order:

install.packages("devtools")
library(devtools)
install.packages("reticulate")
install.packages("tensorflow")
install.packages("keras")
library(tensorflow)
install_tensorflow()
library(keras)
install_keras()
reticulate::py_config()

> reticulate::py_config()
python:         C:/Users/PC/AppData/Local/r-miniconda/envs/r-reticulate/python.exe
libpython:      C:/Users/PC/AppData/Local/r-miniconda/envs/r-reticulate/python36.dll
pythonhome:     C:/Users/PC/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/PC/AppData/Local/r-miniconda/envs/r-reticulate/Lib/site-packages/numpy
numpy_version:  1.19.1

If I run a model I got the following message:

> setwd("C:/Users/PC/Desktop/R/")
> model <- load_model_hdf5("my_model_2c2.h5")

Error: Installation of TensorFlow not found.

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

You can install TensorFlow using the install_tensorflow() function.
I tried also the next solution. I wrote in a .Renviron file the following line into the user's home directory does work.

`Sys.setenv(RETICULATE_PYTHON = "C:/Users/PC/AppData/Local/r-miniconda/")`

But Numpy and Tensorflow are lost after restarting R as illsutrated:


reticulate::py_config()
python: C:/Users/PC/AppData/Local/r-miniconda/python.exe
libpython: C:/Users/PC/AppData/Local/r-miniconda/python38.dll
pythonhome: C:/Users/PC/AppData/Local/r-miniconda
version: 3.8.3 (default, May 7 2020, 19:46:08) [MSC v.1916 64 bit (AMD64)]
Architecture: 64bit
numpy: [NOT FOUND]
Tensorflow: [NOT FOUND]

A post was split to a new topic: package ‘install_tensorflow()’ is not available (for R version 4.0.2)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.