[英]R 3.1.0 Trouble installing Bioconductor package
更新
我在下面發布了工作修補程序。 它不能完全解決問題,但是可以解決。 我仍然希望它能正常工作,所以如果有人添加更好的解決方案,我會選擇它!
我正在嘗試在R中設置環境變量,以便通過代理進行連接,但是我似乎無濟於事。 (編輯:我已經完成了在其他類似帖子中發現的所有建議,通常是通過以某種方式設置http_proxy
或變體)
這是我的sessionInfo()
> sessionInfo()
R version 3.1.0 (2014-04-10)
Platform: x86_64-apple-darwin13.1.0 (64-bit)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] tools_3.1.0
我努力了:
Sys.setenv(http_proxy="SERVER:PORT")
設置代理變量 但是,該變量尚未設置: 編輯:Martin Morgan指出,在getenv
調用中需要引用。 變量已設置。
> Sys.getenv(http_proxy)
[1] ""
> Sys.setenv(http_proxy="SERVER:PORT")
> Sys.getenv(http_proxy)
[1] ""
盡管如此,它似乎能夠連接到代理,但是無論我做什么,我都會得到以下變化:
> options(internet.info=0)
> source("http://bioconductor.org/biocLite.R")
Error in file(filename, "r", encoding = encoding) :
cannot open the connection
In addition: Warning messages:
1: In file(filename, "r", encoding = encoding) :
connected to 'SERVER' on port PORT.
2: In file(filename, "r", encoding = encoding) :
-> (Proxy) GET http://bioconductor.org/biocLite.R HTTP/1.0
Host: bioconductor.org
Pragma: no-cache
User-Agent: R (3.0.3 x86_64-apple-darwin13.1.0 x86_64 darwin13.1.0)
3: In file(filename, "r", encoding = encoding) : <- HTTP/1.1 404 Not Found
4: In file(filename, "r", encoding = encoding) :
<- Content-Type: text/html
5: In file(filename, "r", encoding = encoding) :
<- Date: Wed, 14 May 2014 18:10:32 GMT
6: In file(filename, "r", encoding = encoding) : <- Connection: close
7: In file(filename, "r", encoding = encoding) : <- Server: mwg-ui
8: In file(filename, "r", encoding = encoding) :
Code 404, content-type 'text/html'
9: In file(filename, "r", encoding = encoding) :
cannot open: HTTP status was '404 Not Found'
您會注意到,在上述情況下,我收到404
錯誤; 但是,我可以(並且確實)在瀏覽器中訪問文件。 我也嘗試運行它:
> source("~/Downloads/biocLite.R")
Warning: unable to access index for repository http://www.bioconductor.org/packages/2.14/bioc/src/contrib
'biocLite.R' failed to install 'BiocInstaller', use
'install.packages("BiocInstaller",
repos="http://www.bioconductor.org/packages/2.14/bioc")'
Warning message:
package ‘BiocInstaller’ is not available (for R version 3.1.0)
> install.packages("BiocInstaller",
+ repos="http://www.bioconductor.org/packages/2.14/bioc")
Warning: unable to access index for repository http://www.bioconductor.org/packages/2.14/bioc/src/contrib
Warning message:
package ‘BiocInstaller’ is not available (for R version 3.1.0)
更新:嘗試通過wget
和curl
從命令行下載http://bioconductor.org/biocLite.R
。 效果很好。
更新:根據不同來源的建議,我嘗試了幾件事。
在.Renviron
文件中的值.Renviron
單引號,即“ http_proxy ='SERVER:PORT'。 這改變了一些東西,但仍然沒有成功。 另外,我發現url引號需要加倍。
source(' http://bioconductor.org/biocLite.R ')文件錯誤(文件名“ r”,編碼=編碼):無法打開連接源(“ http://bioconductor.org/biocLite.R “ )警告:無法訪問存儲庫http://www.bioconductor.org/packages/2.14/bioc/src/contrib'biocLite.R '的索引無法安裝'BiocInstaller',請使用'install.packages(“ BiocInstaller”, repos =“ http://www.bioconductor.org/packages/2.14/bioc”)'警告消息:軟件包'BiocInstaller'不可用(對於R版本3.1.0)
使用一個空的.Renviron文件和一個新的終端,運行R --vanilla
並安裝。 目的是確保需要設置代理。 確實如此。
source(' http://bioconductor.org/biocLite.R ')文件錯誤(文件名,“ r”,編碼=編碼):無法打開連接另外:警告消息:在文件(文件名,“ r”,編碼=編碼):無法在端口PORT上連接到“ bioconductor.org”。
在Sys.getenv
調用周圍使用引號:[有效,但不能解決問題]
Sys.getenv(“ http_proxy”)[1]“ http://服務器:端口/”
感謝@zhanxw的評論,我再次查看了正在發生的事情,並且我意識到盡管正在訪問代理服務器,但是R使用了錯誤的端口。
原因如下: http_proxy
的末尾有一個額外的正http_proxy
(我假設),這導致R錯誤地解析了環境變量。 http_proxy =“ http:// [SERVER]:[PORT] /”一旦刪除了尾隨的前斜杠,它就可以正常工作。
以下是我發布的原始“解決方案”。
解決方法,但不是完整的解決方案:
options(download.file.method="wget")
這仍然不能解決原始問題:
source(“ http://bioconductor.org/biocLite.R ”)文件錯誤(文件名“ r”,編碼=編碼):無法打開連接
但這確實允許使用其他方法:
> install.packages("BiocInstaller", repos="http://bioconductor.org/packages/2.14/bioc")--2014-05-14 16:08:18-- http://bioconductor.org/packages/2.14/bioc/src/contrib/BiocInstaller_1.14.2.tar.gz
Resolving SERVER... IP, IP, IP, ...
Connecting to SERVER|IP|:PORT... connected.
Proxy request sent, awaiting response... 200 OK
Length: 14053 (14K) [application/x-gzip]
Saving to: '/var/folders/p1/5gstd7bn1hb1t8pd6b7bp5n00000gp/T//RtmpFm0GR3/downloaded_packages/BiocInstaller_1.14.2.tar.gz'
100%[=============================================>] 14,053 --.-K/s in 0s
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.