-
Notifications
You must be signed in to change notification settings - Fork 282
Description
The problem is that
keras3::install_keras(backend = "tensorflow")creates a virtual environment "r-keras" stored in "D:/Data Folders/Documents/.virtualenvs/r-keras" outside of Miniconda
tensorflow::install_tensorflow()creates a virtual environment "r-tensorflow" stored in "D:/Data Folders/Documents/.virtualenvs/r-tensorflow" outside of Miniconda
I do not know how to fix that. The immediate consequence is that both installations of keras and tensorFlow are not avalaible.
Here are my installation's steps:
-
I couldn't install the development version of packages reticulate and keras3 because their compilation ended with errors. I have R version 4.1.1 and rtools40 installed.
-
I solved the missing rpytools problem with the environmental variable
PYTHONPATH = C:/Program Files/R/R-4.1.1/library/reticulate/python -
I removed the conflicting installation at each of the countless new installation tries.
-
I installed the R package reticulate and Miniconda
install.packages("reticulate") reticulate::install_miniconda()
-
I installed the R package keras3 and its dependence tensorflow
install.packages("keras3") # installs also the R package tensorflow keras3::install_keras(backend = "tensorflow") tensorflow::install_tensorflow()
-
I tested the keras3 installation
library(keras3); library(tensorflow) mnist <- dataset_mnist()
Error: ModuleNotFoundError: No module named 'keras' -
I tested the tensorflow installation
tensorflow::as_tensor("Hello World")
Error: Valid installation of TensorFlow not found. -
reticulate::py_config()
python: C:/Users/Giuseppe/AppData/Local/r-miniconda/envs/r-reticulate/python.exe libpython: C:/Users/Giuseppe/AppData/Local/r-miniconda/envs/r-reticulate/python310.dll pythonhome: C:/Users/Giuseppe/AppData/Local/r-miniconda/envs/r-reticulate version: 3.10.16 | packaged by conda-forge | (main, Dec 5 2024, 14:07:43) [MSC v.1942 64 bit (AMD64)] Architecture: 64bit numpy: C:/Users/Giuseppe/AppData/Local/r-miniconda/envs/r-reticulate/Lib/site-packages/numpy numpy_version: 2.2.4 keras: [NOT FOUND] NOTE: Python version was forced by RETICULATE_PYTHON -
tensorflow::tf_config()
Valid installation of TensorFlow not found. Python environments searched for 'tensorflow' package: C:\Users\Giuseppe\AppData\Local\r-miniconda\envs\r-reticulate\python.exe Python exception encountered: Traceback (most recent call last): File "C:\Program Files\R\R-4.1.1\library\reticulate\python\rpytools\loader.py", line 122, in _find_and_load_hook return _run_hook(name, _hook) File "C:\Program Files\R\R-4.1.1\library\reticulate\python\rpytools\loader.py", line 96, in _run_hook module = hook() File "C:\Program Files\R\R-4.1.1\library\reticulate\python\rpytools\loader.py", line 120, in _hook return _find_and_load(name, import_) ModuleNotFoundError: No module named 'tensorflow' -
reticulate::py_last_error()
-- Python Exception Message -------------------------------------------------------------------------------------------- Traceback (most recent call last): File "C:\Program Files\R\R-4.1.1\library\reticulate\python\rpytools\loader.py", line 122, in _find_and_load_hook return _run_hook(name, _hook) File "C:\Program Files\R\R-4.1.1\library\reticulate\python\rpytools\loader.py", line 96, in _run_hook module = hook() File "C:\Program Files\R\R-4.1.1\library\reticulate\python\rpytools\loader.py", line 120, in _hook return _find_and_load(name, import_) ModuleNotFoundError: No module named 'tensorflow' -- R Traceback --------------------------------------------------------------------------------------------------------- x 1. \-reticulate::import("tensorflow") 2. \-reticulate:::py_module_import(module, convert = convert) See `reticulate::py_last_error()$r_trace$full_call` for more details. -
sessionInfo()
R version 4.1.1 (2021-08-10) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19045) Matrix products: default locale: [1] LC_COLLATE=Italian_Italy.1252 LC_CTYPE=Italian_Italy.1252 LC_MONETARY=Italian_Italy.1252 [4] LC_NUMERIC=C LC_TIME=Italian_Italy.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] tensorflow_2.16.0 keras3_1.3.0 loaded via a namespace (and not attached): [1] Rcpp_1.0.14 rstudioapi_0.17.1 whisker_0.4.1 magrittr_2.0.3 lattice_0.20-44 [6] rlang_1.1.5 dotty_0.1.0 fansi_0.5.0 tools_4.1.1 grid_4.1.1 [11] png_0.1-8 utf8_1.2.2 cli_3.6.4 withr_3.0.2 tfruns_1.5.3 [16] lifecycle_1.0.4 Matrix_1.5-4 vctrs_0.6.5 base64enc_0.1-3 codetools_0.2-18 [21] zeallot_0.1.0 glue_1.8.0 compiler_4.1.1 pillar_1.9.0 generics_0.1.3 [26] reticulate_1.41.0.1 jsonlite_1.9.1
```
I really hope you could help me resolve the mentioned problem because I already invested a lot of time in this project with no results. So please help. Thank you.