【问题标题】:Can't load the library tidyverse, even though I have installed it无法加载库 tidyverse,即使我已经安装了它
【发布时间】:2019-08-21 15:06:08
【问题描述】:

我先跑:

install.packages("tidyverse")

运行完成后,最后会说:

Warning in install.packages :
  installation of package ‘tidyverse’ had non-zero exit status
The downloaded source packages are in
    ‘/tmp/RtmpWG5QjC/downloaded_packages’

但是当我尝试运行时:

library(tidyverse)

我收到这个回复:

Error in library(tidyverse) : there is no package called ‘tidyverse’

然后我在 R 中的 ubuntu 控制台上执行此过程,但我再次得到相同的结果

下载时的整个输出:

Installing package into ‘/home/anastasis/R/x86_64-pc-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
also installing the dependencies ‘curl’, ‘httr’, ‘rvest’, ‘xml2’

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

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

trying URL 'https://cloud.r- 
project.org/src/contrib/rvest_0.3.4.tar.gz'
Content type 'application/x-gzip' length 1631028 bytes (1.6 MB)
==================================================
downloaded 1.6 MB

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

trying URL 'https://cloud.r- 
project.org/src/contrib/tidyverse_1.2.1.tar.gz'
Content type 'application/x-gzip' length 61647 bytes (60 KB)
==================================================
downloaded 60 KB

* installing *source* package ‘curl’ ...
** package ‘curl’ successfully unpacked and MD5 sums checked
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/anastasis/R/x86_64-pc-linux-gnu-library/3.4/curl’
Warning in install.packages :
  installation of package ‘curl’ had non-zero exit status
* installing *source* package ‘xml2’ ...
** package ‘xml2’ successfully unpacked and MD5 sums checked
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/anastasis/R/x86_64-pc-linux-gnu-library/3.4/xml2’
Warning in install.packages :
  installation of package ‘xml2’ had non-zero exit status
ERROR: dependency ‘curl’ is not available for package ‘httr’
* removing ‘/home/anastasis/R/x86_64-pc-linux-gnu-library/3.4/httr’
Warning in install.packages :
  installation of package ‘httr’ had non-zero exit status
ERROR: dependencies ‘xml2’, ‘httr’ are not available for package ‘rvest’
* removing ‘/home/anastasis/R/x86_64-pc-linux-gnu-library/3.4/rvest’
Warning in install.packages :
  installation of package ‘rvest’ had non-zero exit status
ERROR: dependencies ‘httr’, ‘rvest’, ‘xml2’ are not available for 
package ‘tidyverse’
* removing ‘/home/anastasis/R/x86_64-pc-linux-gnu- 
library/3.4/tidyverse’
Warning in install.packages :
  installation of package ‘tidyverse’ had non-zero exit status

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

我已经安装了依赖项 xml2,但是当我使用 tidyverse 重做该过程时,我得到了相同的结果

【问题讨论】:

  • 看看this是否有帮助。
  • 初始消息告诉你,你没有没有成功安装tidyverse。原因可以在安装输出中的另一条消息中找到,通常以“错误:...”开头。在您的情况下,“curl”包安装失败:“错误:包'curl'的配置失败”。您首先需要安装 libcurl (sudo apt install libcurl-openssl-dev)。
  • 两者都不起作用,对于第一条评论它并没有真正起作用,但它说找不到'dplyr.so',对于@KonradRudolph评论它说:无法找到包libcurl-openssl-dev
  • @AnastasisPap。糟糕,拼写错误,应该是libcurl4-openssl-dev。 — 仔细阅读您发布的错误消息,说明实际上都在里面。
  • 是的,它实际上是这么说的,但事实证明我已经安装了它。现在唯一的错误是:包'tidyverse'的延迟加载失败和消息:library.dynam(lib,package,package.lib)中的错误:找不到共享对象'dplyr.so'

标签: r dataframe tidyverse


【解决方案1】:

这对我来说是解决方案(在 Ubuntu 20.04 上):

sudo apt-get install libgdal-dev

【讨论】:

    【解决方案2】:

    library(tidyverse) 是语法错误。

    试试这样的双引号

    图书馆(“tidyverse”)

    【讨论】:

      猜你喜欢
      • 2017-04-30
      • 2016-09-30
      • 2017-04-26
      • 2019-05-09
      • 2021-08-18
      • 1970-01-01
      • 2021-12-03
      • 1970-01-01
      • 2019-12-27
      相关资源
      最近更新 更多