I am attempting to install TensorFlow for R using precisely the instructions provided at :
https://tensorflow.rstudio.com/installation/#installation:
Installation
First, install the tensorflow R package from GitHub as follows:
install.packages("tensorflow")
Then, use the install_tensorflow()
function to install TensorFlow. Note that on Windows you need a working installation of Anaconda.
library(tensorflow)
install_tensorflow()
You can confirm that the installation succeeded with:
library(tensorflow)
tf$constant("Hellow Tensorflow")
## tf.Tensor(b'Hellow Tensorflow', shape=(), dtype=string)
This will provide you with a default installation of TensorFlow suitable for use with the tensorflow R package
The output in RStudio is below:
> install.packages("tensorflow")
Installing package into ‘C:/Users/Owner/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
trying URL 'http://cran.rstudio.com/bin/windows/contrib/4.0/tensorflow_2.2.0.zip'
Content type 'application/zip' length 144557 bytes (141 KB)
downloaded 141 KB
package ‘tensorflow’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\Owner\AppData\Local\Temp\Rtmp6zem10\downloaded_packages
> library("tensorflow")
> install_tensorflow()
Traceback (most recent call last):
File "C:\Users\Owner\AppData\Local\R-MINI~1\lib\site-packages\conda\exceptions.py", line 1079, in __call__
return func(*args, **kwargs)
File "C:\Users\Owner\AppData\Local\R-MINI~1\lib\site-packages\conda\cli\main.py", line 84, in _main
exit_code = do_call(args, p)
File "C:\Users\Owner\AppData\Local\R-MINI~1\lib\site-packages\conda\cli\conda_argparse.py", line 80, in do_call
module = import_module(relative_mod, __name__.rsplit('.', 1)[0])
File "C:\Users\Owner\AppData\Local\R-MINI~1\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\Owner\AppData\Local\R-MINI~1\lib\site-packages\conda\cli\main_install.py", line 8, in <module>
from .install import install
File "C:\Users\Owner\AppData\Local\R-MINI~1\lib\site-packages\conda\cli\install.py", line 19, in <module>
from ..core.index import calculate_channel_urls, get_index
File "C:\Users\Owner\AppData\Local\R-MINI~1\lib\site-packages\conda\core\index.py", line 10, in <module>
from .package_cache_data import PackageCacheData
File "C:\Users\Owner\AppData\Local\R-MINI~1\lib\site-packages\conda\core\package_cache_data.py", line 15, in <module>
from .path_actions import CacheUrlAction, ExtractPackageAction
File "C:\Users\Owner\AppData\Local\R-MINI~1\lib\site-packages\conda\core\path_actions.py", line 30, in <module>
from ..gateways.connection.download import download
File "C:\Users\Owner\AppData\Local\R-MINI~1\lib\site-packages\conda\gateways\connection\download.py", line 18, in <module>
from .session import CondaSession
File "C:\Users\Owner\AppData\Local\R-MINI~1\lib\site-packages\conda\gateways\connection\session.py", line 14, in <module>
from ..anaconda_client import read_binstar_tokens
ModuleNotFoundError: No module named 'conda.gateways.anaconda_client'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Owner\AppData\Local\R-MINI~1\Scripts\conda-script.py", line 12, in <module>
sys.exit(main())
File "C:\Users\Owner\AppData\Local\R-MINI~1\lib\site-packages\conda\cli\main.py", line 150, in main
return conda_exception_handler(_main, *args, **kwargs)
File "C:\Users\Owner\AppData\Local\R-MINI~1\lib\site-packages\conda\exceptions.py", line 1371, in conda_exception_handler
return_value = exception_handler(func, *args, **kwargs)
File "C:\Users\Owner\AppData\Local\R-MINI~1\lib\site-packages\conda\exceptions.py", line 1082, in __call__
return self.handle_exception(exc_val, exc_tb)
File "C:\Users\Owner\AppData\Local\R-MINI~1\lib\site-packages\conda\exceptions.py", line 1126, in handle_exception
return self.handle_unexpected_exception(exc_val, exc_tb)
File "C:\Users\Owner\AppData\Local\R-MINI~1\lib\site-packages\conda\exceptions.py", line 1137, in handle_unexpected_exception
self.print_unexpected_error_report(error_report)
File "C:\Users\Owner\AppData\Local\R-MINI~1\lib\site-packages\conda\exceptions.py", line 1207, in print_unexpected_error_report
from .cli.main_info import get_env_vars_str, get_main_info_str
File "C:\Users\Owner\AppData\Local\R-MINI~1\lib\site-packages\conda\cli\main_info.py", line 19, in <module>
from ..core.index import _supplement_index_with_system
File "C:\Users\Owner\AppData\Local\R-MINI~1\lib\site-packages\conda\core\index.py", line 10, in <module>
from .package_cache_data import PackageCacheData
File "C:\Users\Owner\AppData\Local\R-MINI~1\lib\site-packages\conda\core\package_cache_data.py", line 15, in <module>
from .path_actions import CacheUrlAction, ExtractPackageAction
File "C:\Users\Owner\AppData\Local\R-MINI~1\lib\site-packages\conda\core\path_actions.py", line 30, in <module>
from ..gateways.connection.download import download
File "C:\Users\Owner\AppData\Local\R-MINI~1\lib\site-packages\conda\gateways\connection\download.py", line 18, in <module>
from .session import CondaSession
File "C:\Users\Owner\AppData\Local\R-MINI~1\lib\site-packages\conda\gateways\connection\session.py", line 14, in <module>
from ..anaconda_client import read_binstar_tokens
ModuleNotFoundError: No module named 'conda.gateways.anaconda_client'
Error: installation of 'python=3.6' into environment 'C:/Users/Owner/AppData/Local/r-miniconda/envs/r-reticulate' failed [error code 1]
> tf$constant("Hellow Tensorflow")
Error: Installation of TensorFlow not found.
Python environments searched for 'tensorflow' package:
C:\Users\Owner\AppData\Local\r-miniconda\envs\r-reticulate\python.exe
You can install TensorFlow using the install_tensorflow() function.
> sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets
[6] methods base
other attached packages:
[1] tensorflow_2.2.0
loaded via a namespace (and not attached):
[1] compiler_4.0.3 magrittr_1.5 Matrix_1.2-18
[4] tools_4.0.3 whisker_0.4 base64enc_0.1-3
[7] rappdirs_0.3.1 yaml_2.2.1 Rcpp_1.0.5
[10] reticulate_1.18 grid_4.0.3 jsonlite_1.7.1
[13] tfruns_1.4 lattice_0.20-41