问题
I am totally new to R.
I tried to install the httr package.
I first installed pacman, and then tried to load httr through it by running pacman::p_load(httr)
.
It wasn't successful. And it showed the following message in terminal-
Installing package into ‘/home/|username|/R/x86_64-pc-linux-gnu-library/3.6’ (as ‘lib’ is unspecified) also installing the dependencies ‘curl’, ‘openssl’
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/openssl_1.4.1.tar.gz' Content type 'application/x-gzip' length 1206885 bytes (1.2 MB) ================================================== downloaded 1.2 MB
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
- 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/|username|/R/x86_64-pc-linux-gnu-library/3.6/curl’
- installing source package ‘openssl’ ... ** package ‘openssl’ successfully unpacked and MD5 sums checked ** using staged installation Using PKG_CFLAGS= ------------------------- ANTICONF ERROR --------------------------- 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: configuration failed for package ‘openssl’
- removing ‘/home/|username|/R/x86_64-pc-linux-gnu-library/3.6/openssl’ ERROR: dependencies ‘curl’, ‘openssl’ are not available for package ‘httr’
- removing ‘/home/|username|/R/x86_64-pc-linux-gnu-library/3.6/httr’
The downloaded source packages are in ‘/tmp/Rtmp3wZaOu/downloaded_packages’ Warning messages: 1: In utils::install.packages(package, ...) : installation of package ‘curl’ had non-zero exit status 2: In utils::install.packages(package, ...) : installation of package ‘openssl’ had non-zero exit status 3: In utils::install.packages(package, ...) : installation of package ‘httr’ had non-zero exit status 4: In p_install(package, character.only = TRUE, ...) : 5: In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, : there is no package called ‘httr’ 6: In pacman::p_load(httr) : Failed to install/load: httr
How do I solve this?
Note: I have installed several other external packages through pacman. Like- dplyr, ggplot2 etc.
回答1:
httr
imports openssl
(https://cran.r-project.org/web/packages/openssl/index.html) and curl
(https://cran.r-project.org/web/packages/curl/index.html)
and both are specific system requirements. For openssl
"SystemRequirements: OpenSSL >= 1.0.1" and for curl
"SystemRequirements: libcurl: libcurl-devel (rpm) or libcurl4-openssl-dev (deb)."
来源:https://stackoverflow.com/questions/60287025/cannot-install-httr-package-in-r-3-6-2-in-linux-mint-19-3