使用Anaconda和RStudio安装install_keras的代理问题

时间:2017-11-01 10:11:57

标签: r proxy anaconda rstudio

当我使用办公室/工作笔记本电脑时,我按照https://keras.rstudio.com/中的说明尝试安装Keras。

当我到达这一行install_keras()时,它失败了,这里显示了这个相当长的错误消息:

Creating r-tensorflow conda environment for TensorFlow installation...
Fetching package metadata ...
CondaHTTPError: HTTP 000 CONNECTION FAILED for url 
<https://repo.continuum.io/pkgs/main/win-64/repodata.json.bz2>
Elapsed: -

An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on 
your way.
ProxyError(MaxRetryError("HTTPSConnectionPool(host='repo.continuum.io', 
port=443): Max retries exceeded with url: /pkgs/main/win-6     
/repodata.json.bz2 (Caused by ProxyError('Cannot connect to proxy.', 
NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 
0x000001ACD38FB780>: Failed to establish a new connection: [Errno 11001] 
getaddrinfo failed',)))",),)

Error: Error 1 occurred creating conda environment r-tensorflow
In addition: Warning message:
running command '"C:\PROGRA~3\ANACON~1\Scripts\conda.exe" "create" "--
yes"   "--name" "r-tensorflow" "python=3.6"' had status 1 

它说了一些关于Anaconda的事情。所以我尽职尽责地安装了这个Anaconda distribution的整个Anaconda野兽。

现在,当我尝试install_keras()时,我收到有关代理的新错误消息:

Using r-tensorflow conda environment for TensorFlow installation
Determining latest release of TensorFlow...Error in 
open.connection(con, "rb") : 
Unsupported proxy 'https://proxy-server.mycompanyname.com:8080', libcurl   
is built without the HTTPS-proxy support.

我查看了Jeroen's libcurl suggestion,其中包含以下回复:

curl::ie_proxy_info()

$AutoDetect
[1] FALSE

$AutoConfigUrl
[1] "http://mcd-server/mcd/proxy.pac"

$Proxy
NULL

$ProxyBypass
NULL

和这个

curl::ie_get_proxy_for_url()
[1] "proxy-server:8080"

所以我似乎通过RStudio与互联网建立了良好的联系,但在使用Anaconda的软件时却没有。

我已经确认我使用此网络连接良好:

httr::BROWSE("https://www.ibm.com")

显然,libcurl是在没有HTTPS代理支持的情况下构建的。

有什么建议吗?

1 个答案:

答案 0 :(得分:2)

解决了!

1)步骤1:允许Anaconda访问互联网,方法是添加一个名为 .condarc 的新文件的代理信息,完全按照this answer中的详细说明。您可以通过在Anaconda Prompt应用程序中键入C:\Users\USERNAME\Documents来验证此工作正常。

2)步骤2:允许R和RStudio通过将这两行添加到 .Renviron 文件中来访问互联网(在我的情况下,这可以在{10}中找到,适用于Windows 10) :

http_proxy=http://proxy-server:8080
https_proxy=http://proxy-server:8080

现在可以运行它来安装Keras:

library(keras)
install_keras()
相关问题