安装devtools包时出现问题

时间:2014-01-04 16:00:14

标签: r package devtools

我希望使用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

16 个答案:

答案 0 :(得分:186)

根据damienfrancois的建议,我安装了libcurl4-gnutls-dev,问题解决了。

编辑(@dardisco)

在你的shell中:

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

答案 1 :(得分:86)

如果您使用的是Ubuntu / Linux:

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

答案 2 :(得分:46)

如果您使用的是CentOS:

尝试:

sudo yum -y install libcurl libcurl-devel

答案 3 :(得分:10)

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

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

以您在R中使用

的方式发布此安装库
install.packages("package name")

答案 4 :(得分:9)

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

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

答案 5 :(得分:7)

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

sudo apt-get build-dep libxml2-dev

提示: r-tool控制台输出非常详细,所以我会检查是否还有其他依赖项。

然后,我终于明白了:

> find_rtools()
[1] TRUE

答案 6 :(得分:5)

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

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

private static string NewSecurityStamp()
{
     return Guid.NewGuid().ToString();
}

然后使用这些命令

R --version

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

sudo apt-get update 
sudo apt-get upgrade              

现在只更新R。

sudo apt-cache showpkg r-base

现在R将更新,错误将被删除。确保sudo apt-get install r-base 要安装新软件包的库路径。这种方式在bash终端。尝试在主文件夹中创建R目录,否则它将处于默认状态。找到包~~ R / lib /。

的这个位置
cd

OR

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

答案 7 :(得分:3)

CentOS 7: 我已经安装了libcurl和gnutls开发包,但仍然得到了#34;无法加载git2r.so"在R中安装devtools时出错。我不得不重新安装"他们让它工作:

sudo yum reinstall gnutls-devel.x86_64

答案 8 :(得分:3)

我在尝试安装devtools软件包时看到R-Studio的错误,从而找到了解决方案...基本上是由于未在Linux中安装依赖库而引起的。请看下面的 ANTICONF错误

true

看看缺少的粗体库 libssl开发 libxml2-dev

Installing package into ‘/home/hafiz/R/x86_64-pc-linux-gnu-library/3.6’
(as ‘lib’ is unspecified)
also installing the dependencies ‘curl’, ‘gh’, ‘openssl’, ‘xml2’, ‘usethis’, ‘covr’, ‘httr’, ‘roxygen2’, ‘rversions’


trying URL 'https://cloud.r-project.org/src/contrib/curl_4.3.tar.gz'
Content type 'application/x-gzip' length 673779 bytes (657 KB)
==================================================
downloaded 657 KB

trying URL 'https://cloud.r-project.org/src/contrib/gh_1.1.0.tar.gz'
Content type 'application/x-gzip' length 29043 bytes (28 KB)
==================================================
downloaded 28 KB

trying URL 'https://cloud.r-project.org/src/contrib/openssl_1.4.2.tar.gz'
Content type 'application/x-gzip' length 1204168 bytes (1.1 MB)
==================================================
downloaded 1.1 MB

trying URL 'https://cloud.r-project.org/src/contrib/xml2_1.3.2.tar.gz'
Content type 'application/x-gzip' length 271876 bytes (265 KB)
==================================================
downloaded 265 KB

trying URL 'https://cloud.r-project.org/src/contrib/usethis_1.6.1.tar.gz'
Content type 'application/x-gzip' length 255052 bytes (249 KB)
==================================================
downloaded 249 KB

trying URL 'https://cloud.r-project.org/src/contrib/covr_3.5.0.tar.gz'
Content type 'application/x-gzip' length 146148 bytes (142 KB)
==================================================
downloaded 142 KB

trying URL 'https://cloud.r-project.org/src/contrib/httr_1.4.2.tar.gz'
Content type 'application/x-gzip' length 159950 bytes (156 KB)
==================================================
downloaded 156 KB

trying URL 'https://cloud.r-project.org/src/contrib/roxygen2_7.1.1.tar.gz'
Content type 'application/x-gzip' length 254118 bytes (248 KB)
==================================================
downloaded 248 KB

trying URL 'https://cloud.r-project.org/src/contrib/rversions_2.0.2.tar.gz'
Content type 'application/x-gzip' length 41558 bytes (40 KB)
==================================================
downloaded 40 KB

trying URL 'https://cloud.r-project.org/src/contrib/devtools_2.3.1.tar.gz'
Content type 'application/x-gzip' length 373604 bytes (364 KB)
==================================================
downloaded 364 KB

* installing *source* package ‘curl’ ...
** package ‘curl’ successfully unpacked and MD5 sums checked
** using staged installation
Package libcurl was not found in the pkg-config search path.
Perhaps you should add the directory containing `libcurl.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libcurl' found
Package libcurl was not found in the pkg-config search path.
Perhaps you should add the directory containing `libcurl.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libcurl' found
Using PKG_CFLAGS=
Using PKG_LIBS=-lcurl
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because libcurl was not found. Try installing:
  deb: **libcurl4-openssl-dev** (Debian, Ubuntu, etc)
 * rpm: libcurl-devel (Fedora, CentOS, RHEL)
 * csw: libcurl_dev (Solaris)
If libcurl is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a libcurl.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
--------------------------------------------------------------------
ERROR: configuration failed for package ‘curl’
* removing ‘/home/hafiz/R/x86_64-pc-linux-gnu-library/3.6/curl’
Warning in install.packages :
  installation of package ‘curl’ had non-zero exit status
* installing *source* package ‘openssl’ ...
** package ‘openssl’ successfully unpacked and MD5 sums checked
** using staged installation
Using PKG_CFLAGS=
--------------------------- [ANTICONF] --------------------------------
Configuration failed because openssl was not found. Try installing:
  deb: **libssl-dev** (Debian, Ubuntu, etc)
 * rpm: openssl-devel (Fedora, CentOS, RHEL)
 * csw: libssl_dev (Solaris)
 * brew: openssl@1.1 (Mac OSX)
If openssl is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a openssl.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
-------------------------- [ERROR MESSAGE] ---------------------------
tools/version.c:1:10: fatal error: openssl/opensslv.h: No such file or directory
    1 | #include <openssl/opensslv.h>
      |          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
--------------------------------------------------------------------
ERROR: configuration failed for package ‘openssl’
* removing ‘/home/hafiz/R/x86_64-pc-linux-gnu-library/3.6/openssl’
Warning in install.packages :
  installation of package ‘openssl’ had non-zero exit status
* installing *source* package ‘xml2’ ...
** package ‘xml2’ successfully unpacked and MD5 sums checked
** using staged installation
Package libxml-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libxml-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libxml-2.0' found
Package libxml-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libxml-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libxml-2.0' found
Using PKG_CFLAGS=
Using PKG_LIBS=-lxml2
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because libxml-2.0 was not found. Try installing:
 deb: **libxml2-dev** (Debian, Ubuntu, etc)
 * rpm: libxml2-devel (Fedora, CentOS, RHEL)
 * csw: libxml2_dev (Solaris)
If libxml-2.0 is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a libxml-2.0.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
--------------------------------------------------------------------
ERROR: configuration failed for package ‘xml2’
* removing ‘/home/hafiz/R/x86_64-pc-linux-gnu-library/3.6/xml2’
Warning in install.packages :
  installation of package ‘xml2’ had non-zero exit status
ERROR: dependencies ‘curl’, ‘openssl’ are not available for package ‘httr’
* removing ‘/home/hafiz/R/x86_64-pc-linux-gnu-library/3.6/httr’
Warning in install.packages :
  installation of package ‘httr’ had non-zero exit status
ERROR: dependency ‘xml2’ is not available for package ‘roxygen2’
* removing ‘/home/hafiz/R/x86_64-pc-linux-gnu-library/3.6/roxygen2’
Warning in install.packages :
  installation of package ‘roxygen2’ had non-zero exit status
ERROR: dependencies ‘curl’, ‘xml2’ are not available for package ‘rversions’
* removing ‘/home/hafiz/R/x86_64-pc-linux-gnu-library/3.6/rversions’
Warning in install.packages :
  installation of package ‘rversions’ had non-zero exit status
ERROR: dependency ‘httr’ is not available for package ‘gh’
* removing ‘/home/hafiz/R/x86_64-pc-linux-gnu-library/3.6/gh’
Warning in install.packages :
  installation of package ‘gh’ had non-zero exit status
ERROR: dependency ‘httr’ is not available for package ‘covr’
* removing ‘/home/hafiz/R/x86_64-pc-linux-gnu-library/3.6/covr’
Warning in install.packages :
  installation of package ‘covr’ had non-zero exit status
ERROR: dependencies ‘curl’, ‘gh’ are not available for package ‘usethis’
* removing ‘/home/hafiz/R/x86_64-pc-linux-gnu-library/3.6/usethis’
Warning in install.packages :
  installation of package ‘usethis’ had non-zero exit status
ERROR: dependencies ‘usethis’, ‘covr’, ‘httr’, ‘roxygen2’, ‘rversions’ are not available for package ‘devtools’
* removing ‘/home/hafiz/R/x86_64-pc-linux-gnu-library/3.6/devtools’
Warning in install.packages :
  installation of package ‘devtools’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/Rtmpexapon/downloaded_packages’

无论使用哪种操作系统,都会发现相对错误w r t 操作系统,请参见错误。.R-studio提到了相对于操作系统的相对库软件包名称

对于Ubuntu,我做到了

sudo apt-get install libssl-dev

** sudo apt-get install libxml2-dev **

sudo apt-get install libcurl4-openssl-dev

答案 9 :(得分:1)

我在Ubuntu 18.04上遇到了这个问题,以前的答案都没有解决它。最终,我通过软件包管理器本身安装了devtools

sudo apt install r-cran-devtools

答案 10 :(得分:1)

以上答案均不适用于使用 R版本3.6.1

Ubuntu 18.04.3 LTS

我的猜测是,这可能与public String toString() { return Arrays.asList(data).stream() .limit(len) .map(Element::toString) .collect(Collectors.joining(",")); } 有关...

对我有用的是:

Anaconda3

然后在conda install -c r r-devtools

R

install.packages("rlang") install.packages("devtools")

sessionInfo()

答案 11 :(得分:1)

我通过安装以下所有工具解决了许多问题,以使devtools可以在Ubuntu 18.04.1。上安装。

sudo apt-get install libcurl4-openssl-dev
sudo apt-get install libssl-dev
sudo apt-get install libcurl4-gnutls-dev
sudo apt-get install libxml2-dev

答案 12 :(得分:0)

Centos 6.8

这对我来说就像魅力

  1. 安装libcurl $yum -y install libcurl libcurl-devel
  2. 重新启动R软件$rstudio-server verify-installation

答案 13 :(得分:0)

CentOS 7:

我在这篇文章中尝试了解决方法

sudo yum -y install libcurl libcurl-devel
sudo yum -y install openssl-devel

但是还不够。

在控制台中检查R错误给了我答案。在我的情况下,它缺少以下libxml-2.0(并且Console在不同的Linux版本和其他可能的R config上打印了带有软件包名称的说明)

sudo yum -y install libxml2-devel

答案 14 :(得分:0)

我在Windows上遇到了同样的问题。

我使用了以下代码:

install.packages("devtools", type = "win.binary")

然后库(devtools)为我工作了。

答案 15 :(得分:0)

对于 Ubuntu 18.0.4 上的 R 版本 4.0.2,我必须安装 libgit2-dev 包:

sudo apt-get install libgit2-dev

在那之后,工作就像一个魅力。