在R中安装TensorFlow

3
尝试通过R内核在Google Cloud AI平台笔记本上使用install_tensorflow安装TensorFlow:
platform       x86_64-pc-linux-gnu         
arch           x86_64                      
os             linux-gnu                   
system         x86_64, linux-gnu           
status                                     
major          3                           
minor          6.1                         
year           2019                        
month          07                          
day            05                          
svn rev        76782                       
language       R                           
version.string R version 3.6.1 (2019-07-05)
nickname       Action of the Toes

我运行:

install.packages(c("tfestimators", "tfdatasets", "cloudml", "rjson"))
library(tfestimators) # used for creating tensorflow estimators
library(tfdatasets) # used for creating data input functions
library(cloudml) # used for training and deploying models to AI Platform
install_tensorflow()

我收到:

Error in virtualenv_install(envname, packages, ...): unused arguments (python_version = conda_python_version, pip = TRUE)Traceback:1. install_tensorflow()2. reticulate::py_install(packages = c(package, extra_packages), . envname = envname, method = method, conda = conda, python_version = conda_python_version, . pip = TRUE, ...)
1个回答

5

我尝试安装R的Keras时,遇到了同样的错误。从CRAN更新到最新版本的reticulate,从Github更新到最新版本的tensorflow解决了这个问题:

install.packages("reticulate")
devtools::install_github("rstudio/tensorflow")

然后

library(tensorflow)
install_tensorflow()

我使用conda而不是venvs。


谢谢回复,我仍然遇到了相同的错误。我正在使用带有R内核的Jupyter Notebook,如何定义conda或venv环境? - gogasca
install_tensorflow 中的 method 参数可以选择安装方法:https://tensorflow.rstudio.com/tensorflow/articles/installation.html#installation-methods - Paul
安装以下程序包("tfestimators","tfdatasets","cloudml","rjson","reticulate")即可解决问题。 - gogasca
我曾经遇到过同样的问题,安装reticulate、tensorflow和keras可以解决这个问题: devtools::install_github("rstudio/reticulate") devtools::install_github("rstudio/tensorflow") devtools::install_github("rstudio/keras") - Julian

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接