Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 3.1.0安装Bioconductor组件时出现问题_R_Macos_Proxy_Bioconductor - Fatal编程技术网

R 3.1.0安装Bioconductor组件时出现问题

R 3.1.0安装Bioconductor组件时出现问题,r,macos,proxy,bioconductor,R,Macos,Proxy,Bioconductor,更新 我在下面发布了一个工作补丁。这并不能完全解决问题,但它是一种变通方法。我仍然想让它工作,所以如果有人添加更好的解决方案,我会选择它 问题 我试图在R中设置环境变量,以便通过代理进行连接,但我所做的一切似乎都不起作用。(编辑:我已经完成了我在其他类似帖子中发现的所有建议,通常是通过设置http\u proxy或某种方式的变体) 这是我的sessionInfo() 我试过: 在.Renviron和.Rprofile中设置“http_代理”(包括所有CAP和https变体) 在终端中设置代理变量

更新

我在下面发布了一个工作补丁。这并不能完全解决问题,但它是一种变通方法。我仍然想让它工作,所以如果有人添加更好的解决方案,我会选择它

问题 我试图在R中设置环境变量,以便通过代理进行连接,但我所做的一切似乎都不起作用。(编辑:我已经完成了我在其他类似帖子中发现的所有建议,通常是通过设置
http\u proxy
或某种方式的变体)

这是我的
sessionInfo()

我试过:

  • 在.Renviron和.Rprofile中设置“http_代理”(包括所有CAP和https变体)
  • 在终端中设置代理变量
  • 通过Sys.setenv(http\u proxy=“SERVER:PORT”)
  • 以上所有内容都适用于RStudio和命令行R
  • 但是,未设置变量: 编辑:Martin Morgan指出我需要在
    getenv
    调用中引用。变量已设置

    尽管如此,它似乎能够连接到代理,但无论我做什么,我都会得到以下变化:

    > 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'
    
    更新:已尝试下载
    http://bioconductor.org/biocLite.R
    通过命令行中的
    wget
    curl
    。很好用

    更新:在收到不同来源的建议后,我尝试了一些事情

  • .Renviron
    文件中的值周围加上单引号,即“http_proxy='SERVER:PORT”。 这改变了一些东西,但仍然没有成功。另外,我发现url引号必须是双引号

    来源(“”) 文件错误(文件名为“r”,编码=编码): 无法打开连接 来源(“”) 警告:无法访问存储库的索引 “BioLite.R”无法安装“BioInstaller”,请使用 'install.packages(“BiocInstaller”, 回购协议=”http://www.bioconductor.org/packages/2.14/bioc")' 警告信息: 软件包“BioInstaller”不可用(适用于R版本3.1.0)

  • 使用空的.Renviron文件和新的终端,运行
    R--vanilla
    并安装。这是为了确保需要设置代理。确实如此

    来源(“”) 文件错误(文件名为“r”,编码=编码): 无法打开连接 此外:警告信息: 在文件中(文件名为“r”,编码=编码): 无法连接到端口上的“bioconductor.org”

  • Sys.getenv
    调用中使用引号:[工作正常,但无法解决问题]

    Sys.getenv(“http_代理”) [1] “http://SERVER:PORT/”


  • 多亏了@zhanxw的评论,我又看了一眼发生了什么,我意识到尽管代理服务器正在被访问,但R使用了错误的端口

    原因如下:我在
    http\u proxy
    的末尾有一个额外的正斜杠,这(我假设)导致R错误地解析环境变量。 http_proxy=“http://[SERVER]:[PORT]/” 一旦我删除了后面的正斜杠,它就可以正常工作了

    下面是我发布的原始“解决方案”


    解决方案,但不是完整的解决方案:

    options(download.file.method="wget")
    
    这仍然无法解决原始问题:

    来源(“”) 文件错误(文件名为“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    
    

    标题是什么?您有v3.1.0而不是3.03Ah…谢谢。我从3.03开始,然后在尝试解决它的同时进行了更新。无论哪种方式,结果都是一样的。引用Sys.getenv(“http_proxy”)的参数,尽管我不知道这对您的问题有什么帮助。它确实修复了
    getenv
    调用。非常感谢。我认为source()与download.file.method选项无关,因此它可能无法工作,但是,download.file()尊重它,所以您可以这样做:download.file(
    )http://bioconductor.org/biocLite.R“
    ,“biocLite.R”);source(“biocLite.R”)关于“source()”的说法是正确的。不幸的是,如果我没记错的话,下载该文件仍然无法工作,因为后续的“source()”仍然试图通过防火墙并失败。@muppetjones错误消息是什么?我现在正在使用UTSW VPN,我可以运行
    source(“http://bioconductor.org/biocLite.R)
    没有问题。(R-3.1.0,设置了proxy_http环境变量。)
    > 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) 
    
    options(download.file.method="wget")
    
    > 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