配置失败,因为找不到libcurl

lau*_*kok 31 ubuntu curl r rstudio

我试图从远程服务器中提取一些json数据fromJSON:

> server <- 'http://111.111.000.00:3000'
> streams <- fromJSON(paste(server, '/output/streams', sep=""), flatten=TRUE)
Run Code Online (Sandbox Code Playgroud)

结果:

Error: Required package curl not found. 
Please run: install.packages('curl')
Run Code Online (Sandbox Code Playgroud)

所以我试着安装它:

> install.packages("curl")
Installing package into ‘/home/lauxxx/R/x86_64-pc-linux-gnu-library/3.3’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/curl_2.3.tar.gz'
Content type 'application/x-gzip' length 400460 bytes (391 KB)
==================================================
downloaded 391 KB

* installing *source* package ‘curl’ ...
** package ‘curl’ successfully unpacked and MD5 sums checked
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/lauxxx/R/x86_64-pc-linux-gnu-library/3.3/curl’
Warning in install.packages :
  installation of package ‘curl’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/RtmpdoavNf/downloaded_packages’
Run Code Online (Sandbox Code Playgroud)

然后我尝试安装libcurl4-openssl-dev:

> install.packages("libcurl4-openssl-dev")
Installing package into ‘/home/lau/R/x86_64-pc-linux-gnu-library/3.3’
(as ‘lib’ is unspecified)
Warning in install.packages :
  package ‘libcurl4-openssl-dev’ is not available (for R version 3.3.1)
Run Code Online (Sandbox Code Playgroud)

为什么?出了什么问题?我该如何解决?

我在Xubuntu 16.04上时没关系.但现在我在Kubuntu 16.10.

有任何想法吗?

GGa*_*mba 48

libcurl4-openssl-dev 不是R包,而是linux库.

在控制台类型中:

sudo apt-get install libcurl4-openssl-dev
Run Code Online (Sandbox Code Playgroud)

注意:你需要sudo权力.

  • 要安装所有“tidyverse”依赖项,我还需要安装 libssl,我运行的是 Ubuntu 20.04。因此,我输入:`sudo apt-get install libssl-dev` (2认同)

小智 12

Linux版本是:CentOS Linux版本7.3.1611(核心版)

在我的情况下,我试图安装R包:devtools

------------------------- 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=...'
Run Code Online (Sandbox Code Playgroud)

我查了一下$PATH,'pkg-config'在PATH中.但PKG_CONFIG_PATH中没有libcurl.pc文件(./usr/local/lib/pkgconfig/)

这是我解决问题的方法.

su
wget https://github.com/curl/curl/releases/download/curl-7_55_0/curl-7.55.0.tar.gz
./configure
make 
make install
Run Code Online (Sandbox Code Playgroud)

在此之后,我在PKG_CONFIG_PATH()中看到了libcurl.pc文件./usr/local/lib/pkgconfig/


小智 10

刚刚在使用 GitHub actions 按 cron 计划运行 R 脚本时遇到了这个问题。

弹出sudo apt-get install libcurl4-openssl-devR 文件中的 system() 是可行的。比在运行器上单独设置 bash 命令要容易得多。

system("sudo apt-get install libcurl4-openssl-dev")
Run Code Online (Sandbox Code Playgroud)


Ada*_*ley 5

尽管已经libcurl4-openssl-dev apt安装了该软件包,但我在 Ubuntu Server 18.04 上遇到了此错误。我必须查找软件包的安装位置libcurl.pc才能确定要使用的命令:

wget <curl-package-address>
R CMD INSTALL --configure-vars='LIB_DIR=/usr/lib/x86_64-linux-gnu/pkgconfig' <curl-file.gz>
Run Code Online (Sandbox Code Playgroud)

(检查“ANTICONF ERROR”上方的消息,以获取要下载和安装的正确文件。对于提问者来说是https://cran.rstudio.com/src/contrib/curl_2.3.tar.gz;我的是https://cloud.r-project.org/src/contrib/curl_4.3.tar.gz。)


小智 5

------------------------- 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)
Run Code Online (Sandbox Code Playgroud)

我在 Fedora Workstation 33 中安装 R 包时遇到了这个问题。按照提示,请务必安装libcurl-devel适当的架构,在本例中libcurl-devel.x86_64

sudo dnf install openssl-dev libcurl-devel.x86_64
Run Code Online (Sandbox Code Playgroud)