首页 文章

安装devtools包时出现问题

提问于
浏览
139

我希望使用 devtools 包 . 我运行以下命令:

> install.packages("devtools", dependencies = TRUE)
....
> library(devtools)
Error in library(devtools) : there is no package called ‘devtools’

我究竟做错了什么?

编辑:以下是重新启动会话后重新运行 install.packages 命令的结果 .

> install.packages("devtools", dependencies = TRUE)
Installing package into ‘/home/evanaad/R/x86_64-pc-linux-gnu-library/3.0’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
Warning: dependencies ‘roxygen2’, ‘BiocInstaller’, ‘rstudio’ are not available
also installing the dependencies ‘httr’, ‘RCurl’

trying URL 'http://cran.at.r-project.org/src/contrib/httr_0.2.tar.gz'
Content type 'application/x-gzip' length 50183 bytes (49 Kb)
opened URL
==================================================
downloaded 49 Kb

trying URL 'http://cran.at.r-project.org/src/contrib/RCurl_1.95-4.1.tar.gz'
Content type 'application/x-gzip' length 870915 bytes (850 Kb)
opened URL
==================================================
downloaded 850 Kb

trying URL 'http://cran.at.r-project.org/src/contrib/devtools_1.4.1.tar.gz'
Content type 'application/x-gzip' length 105214 bytes (102 Kb)
opened URL
==================================================
downloaded 102 Kb

* installing *source* package ‘RCurl’ ...
** package ‘RCurl’ successfully unpacked and MD5 sums checked
checking for curl-config... no
Cannot find curl-config
ERROR: configuration failed for package ‘RCurl’
* removing ‘/home/evanaad/R/x86_64-pc-linux-gnu-library/3.0/RCurl’
ERROR: dependency ‘RCurl’ is not available for package ‘httr’
* removing ‘/home/evanaad/R/x86_64-pc-linux-gnu-library/3.0/httr’
ERROR: dependencies ‘httr’, ‘RCurl’ are not available for package ‘devtools’
* removing ‘/home/evanaad/R/x86_64-pc-linux-gnu-library/3.0/devtools’

The downloaded source packages are in
    ‘/tmp/RtmptvmTrA/downloaded_packages’
Warning messages:
1: In install.packages("devtools", dependencies = TRUE) :
  installation of package ‘RCurl’ had non-zero exit status
2: In install.packages("devtools", dependencies = TRUE) :
  installation of package ‘httr’ had non-zero exit status
3: In install.packages("devtools", dependencies = TRUE) :
  installation of package ‘devtools’ had non-zero exit status

8 回答

  • 180

    按照_1828758的建议,我安装了libcurl4-gnutls-dev,问题解决了 .

    编辑(@dardisco)

    在你的shell中:

    apt-get -y build-dep libcurl4-gnutls-dev
    apt-get -y install libcurl4-gnutls-dev
    
  • 46

    如果您使用的是Ubuntu / Linux:

    sudo apt-get install libcurl4-openssl-dev libssl-dev
    
  • 9

    如果您使用的是CentOS:

    尝试:

    sudo yum -y install libcurl libcurl-devel
    
  • 7

    如今(ubuntu 14.04)我需要两个:

    $ sudo apt-get -y install libcurl4-gnutls-dev
     $ sudo apt-get -y install libssl-dev
    
  • 4

    对于ubuntu用户,请在终端中运行此命令[在UBUNTU 16.04中测试]

    sudo apt-get -y install libcurl4-openssl-dev
    

    以通常在R中使用的方式发布此安装库

    install.packages("package name")
    
  • 8

    对于我的Debian Jessie盒子,我还包括:

    sudo apt-get build-dep libxml2-dev
    

    提示:r-tool控制台输出非常详细,所以我会检查任何其他依赖项 .

    然后,我终于明白了:

    > find_rtools()
    [1] TRUE
    
  • 79

    解决此问题的最佳解决方案我正在寻找同样的问题 . 我花了1天然后我得到了解决方案 . 现在,这很好 .

    如果您使用的是Ubuntu或Linux,请在bash终端中检查您的R版本 .

    R --version
    

    然后使用这些命令

    sudo apt-get update 
    sudo apt-get upgrade
    

    现在检查R的新版本 . 使用此命令

    sudo apt-cache showpkg r-base
    

    现在只更新R .

    sudo apt-get install r-base
    

    现在R将更新,错误将被删除 . 确保 cd 要安装新软件包的库路径 . 这种方式在bash终端 . 尝试在主文件夹中创建R目录,否则它将处于默认状态 . 找到包〜/ R / lib /的这个位置 .

    R
    .libPaths("~/R/lib")
    install.packages("devtools")
    

    要么

    install.packages("devtools", lib="~/R/lib")
    
  • 3

    CentOS 7:我已经安装了libcurl和gnutls开发包,但在R中安装devtools时仍然出现“无法加载git2r.so”错误 . 我必须“重新安装”它们才能使用它:

    sudo yum reinstall gnutls-devel.x86_64
    

相关问题