rstudio / tensorflow

TensorFlow for R
https://tensorflow.rstudio.com
Apache License 2.0
1.33k stars 321 forks source link

Installation of TensorFlow not found. #425

Closed lipinu closed 3 years ago

lipinu commented 4 years ago

Encounter issue as tittle stated. After refer to issue #144, try all the tricks there,

I have tried uninstalling and reinstalling Anaconda, conda update --all, and then

devtools::install_github("rstudio/reticulate")
devtools::install_github("rstudio/tensorflow")
library(tensorflow)
install_tensorflow(envname = "tf")

But still can not work. Any help would be much appreciated.

1: output from install_tensorflow()

Collecting package metadata (current_repodata.json): ...working... done Solving environment: ...working... done All requested packages already installed.

2: sessionInfo()

R version 4.0.1 (2020-06-06) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 18362) Matrix products: default Random number generation: RNG: Mersenne-Twister Normal: Inversion Sample: Rounding

locale: [1] LC_COLLATE=Chinese (Simplified)_China.936 LC_CTYPE=Chinese (Simplified)_China.936
[3] LC_MONETARY=Chinese (Simplified)_China.936 LC_NUMERIC=C
[5] LC_TIME=Chinese (Simplified)_China.936

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] tensorflow_2.2.0.9000

loaded via a namespace (and not attached): [1] Rcpp_1.0.4.6 lattice_0.20-41 fansi_0.4.1 crayon_1.3.4
[5] assertthat_0.2.1 grid_4.0.1 jsonlite_1.6.1 magrittr_1.5
[9] tfruns_1.4 rlang_0.4.6 cli_2.0.2 rstudioapi_0.11
[13] whisker_0.4 Matrix_1.2-18 reticulate_1.16-9000 tools_4.0.1
[17] glue_1.4.1 compiler_4.0.1 base64enc_0.1-3

3: reticulate::conda_list()

name                                                                              python

1 r-miniconda C:\Users\LX811\AppData\Local\r-miniconda\python.exe 2 r-reticulate C:\Users\LX811\AppData\Local\r-miniconda\envs\r-reticulate\python.exe 3 Anaconda D:\Anaconda\python.exe 4 tf D:\Anaconda\envs\tf\python.exe

4:reticulate::py_config()

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

5: output from sess <- tf$Session()

2020-06-22 00:35:29.312823: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found 2020-06-22 00:35:29.313185: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine. Error: Installation of TensorFlow not found. Python environments searched for 'tensorflow' package: C:\Users\LX\AppData\Local\r-miniconda\envs\r-reticulate\python.exe You can install TensorFlow using the install_tensorflow() function.

arashHaratian commented 4 years ago

my suggestion is to install anaconda and create an environment called "r-reticulate".

you can do it using anaconda navigator or

reticulate::conda_create(envname = "r-reticulate")

then to check that env detected by reticulate, use reticulate::conda_python().it must return directory of python.exe for your env. after that you can install tensorflow by install_tensorflow(). [not working in my case]

so I install the tesnorflow from CMD. follow these steps:

  1. open the cmd :]

  2. 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)

  3. use : conda install -c anaconda tensorflow

now in R, you can use TensorFlow. for installing Keras, you can use pip install Keras. [I tried install_keras() function after the installation of tensorflow, but it n

t-kalinowski commented 3 years ago

Hello,

The code that installs tensorflow and keras has been refactored. Please update to the latest versions of reticulate, tensorflow, and keras:

install.packages("remotes")
remotes::install_github(paste0("rstudio/", c("reticulate", "tensorflow", "keras")))
reticulate::install_miniconda() # skip this if you want to self-install conda or use venv
keras::install_keras()

Please let us know if after updating you are still encountering installation issues: https://github.com/rstudio/tensorflow/issues/new