lost numpy for Keras in R

I installed Keras, Tensorflow and reticulate packages in R and when I check the version of Python used it's given 3.6 in the r-reticulate folder (so I cannot use Keras as need 3.7). So I run the following line to change the folder to pick up the latest Python version:

use_python("C:/Users/PC/AppData/Local/r-miniconda/", required = TRUE)

Now I lost Numpy. How to change the python version in r-reticulate without losing Numpy ? Or can I specify numpy folder ?

> library(reticulate)
> reticulate::py_config()
python:         C:/Users/Mezeix/AppData/Local/r-miniconda/python.exe
libpython:      C:/Users/Mezeix/AppData/Local/r-miniconda/python38.dll
pythonhome:     C:/Users/Mezeix/AppData/Local/r-miniconda
version:        3.8.3 (default, May 19 2020, 06:50:17) [MSC v.1916 64 bit (AMD64)]
Architecture:   64bit
numpy:           [NOT FOUND]

NOTE: Python version was forced by use_python function

Yes, but that would be complicated and prone to failure. I think it is better if you simply install Numpy for the new python version, check this article to learn how to do it.

Thanks for the help. Here the solution to replace Python 3.6 installed with Tensorflow in r-reticulate folder by Python 3.8.

install.packages("reticulate")
install.packages("tensorflow")
install.packages("keras")
library(tensorflow)
tensorflow::install_tensorflow()
library(keras)
keras::install_keras()
library(reticulate)
# create a new environment 
conda_create("r-reticulate")
# install SciPy
conda_install("r-reticulate", "scipy")
# import SciPy (it will be automatically discovered in "r-reticulate")
scipy <- import("scipy")

py_config()
python:         C:/Users/Mezeix/AppData/Local/r-miniconda/envs/r-reticulate/python.exe
libpython:      C:/Users/Mezeix/AppData/Local/r-miniconda/envs/r-reticulate/python38.dll
pythonhome:     C:/Users/Mezeix/AppData/Local/r-miniconda/envs/r-reticulate
version:        3.8.5 | packaged by conda-forge | (default, Jul 31 2020, 01:53:45) [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

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.