如何设置R,使它可以正确地访问系统实用程序和二进制文件,如curl,openssl等?

zdwk9cvp  于 2023-01-10  发布在  其他
关注(0)|答案(1)|浏览(83)

我在Fedora 37上,安装tidyverse失败。
当我第一次尝试install.packages("tidyverse")时,我收到了一系列警告,说R无法解析curl、openssl、googlesheets 4等的安装。更具体地说,“在install.package(“{插入包名}”)中:安装具有非零退出状态”
然后我尝试了install.packages(c("tidyverse","ids", "httr", "gargle" ,"rvest", "covr"), dependencies = TRUE),只得到了同样的错误,然后一些。
依赖项有依赖项,那么是否有办法允许安装子依赖项呢?
但更重要的是,我确实安装了curlopenssl,所以,这可能更多地是R没有找到它们的问题(除非R的curl是系统curl以外的东西)。
如何将所有依赖项请求设置为TRUE,或者检查R是否可以访问系统工具,如果不能,则使它们对R可用?
在Jupyter中这样做,编辑器的全文如下:

Installing packages into ‘/home/rijan/R/x86_64-redhat-linux-gnu-library/4.2’
(as ‘lib’ is unspecified)

also installing the dependencies ‘googledrive’, ‘googlesheets4’, ‘openssl’, ‘curl’, ‘jpeg’, ‘aws.ec2metadata’, ‘sodium’

Warning message in install.packages(c("tidyverse", "ids", "httr", "gargle", "rvest", :
“installation of package ‘openssl’ had non-zero exit status”
Warning message in install.packages(c("tidyverse", "ids", "httr", "gargle", "rvest", :
“installation of package ‘curl’ had non-zero exit status”
Warning message in install.packages(c("tidyverse", "ids", "httr", "gargle", "rvest", :
“installation of package ‘jpeg’ had non-zero exit status”
Warning message in install.packages(c("tidyverse", "ids", "httr", "gargle", "rvest", :
“installation of package ‘sodium’ had non-zero exit status”
Warning message in install.packages(c("tidyverse", "ids", "httr", "gargle", "rvest", :
“installation of package ‘aws.ec2metadata’ had non-zero exit status”
Warning message in install.packages(c("tidyverse", "ids", "httr", "gargle", "rvest", :
“installation of package ‘ids’ had non-zero exit status”
Warning message in install.packages(c("tidyverse", "ids", "httr", "gargle", "rvest", :
“installation of package ‘httr’ had non-zero exit status”
Warning message in install.packages(c("tidyverse", "ids", "httr", "gargle", "rvest", :
“installation of package ‘gargle’ had non-zero exit status”
Warning message in install.packages(c("tidyverse", "ids", "httr", "gargle", "rvest", :
“installation of package ‘rvest’ had non-zero exit status”
Warning message in install.packages(c("tidyverse", "ids", "httr", "gargle", "rvest", :
“installation of package ‘covr’ had non-zero exit status”
Warning message in install.packages(c("tidyverse", "ids", "httr", "gargle", "rvest", :
“installation of package ‘googledrive’ had non-zero exit status”
Warning message in install.packages(c("tidyverse", "ids", "httr", "gargle", "rvest", :
“installation of package ‘googlesheets4’ had non-zero exit status”
Warning message in install.packages(c("tidyverse", "ids", "httr", "gargle", "rvest", :
“installation of package ‘tidyverse’ had non-zero exit status”

当从Jupyter笔记本电脑切换到终端中的R,并使用命令install.packages("curl", verbose = TRUE, dependencies = TRUE)时,我得到以下错误消息:

Installing package into ‘/home/rijan/R/x86_64-redhat-linux-gnu-library/4.2’
(as ‘lib’ is unspecified)
system (cmd0): /usr/lib64/R/bin/R CMD INSTALL
--- Please select a CRAN mirror for use in this session ---
also installing the dependency ‘webutils’

trying URL 'https://cloud.r-project.org/src/contrib/webutils_1.1.tar.gz'
Content type 'application/x-gzip' length 24751 bytes (24 KB)
==================================================
downloaded 24 KB

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

foundpkgs: webutils, curl, /tmp/RtmpojeCdr/downloaded_packages/webutils_1.1.tar.gz, /tmp/RtmpojeCdr/downloaded_packages/curl_4.3.3.tar.gz
files: /tmp/RtmpojeCdr/downloaded_packages/webutils_1.1.tar.gz, 
    /tmp/RtmpojeCdr/downloaded_packages/curl_4.3.3.tar.gz
* 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
Package 'libcurl', required by 'virtual:world', not 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
Package 'libcurl', required by 'virtual:world', not 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)
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/rijan/R/x86_64-redhat-linux-gnu-library/4.2/curl’
ERROR: dependency ‘curl’ is not available for package ‘webutils’
* removing ‘/home/rijan/R/x86_64-redhat-linux-gnu-library/4.2/webutils’

The downloaded source packages are in
    ‘/tmp/RtmpojeCdr/downloaded_packages’
Warning messages:
1: In install.packages("curl", verbose = TRUE, dependencies = TRUE) :
  installation of package ‘curl’ had non-zero exit status
2: In install.packages("curl", verbose = TRUE, dependencies = TRUE) :
  installation of package ‘webutils’ had non-zero exit status

尝试sudo dnf install libcurl-devel解决了curl的问题。

brvekthn

brvekthn1#

安装tidyverse需要以下系统依赖项(fedora特定安装命令):
sudo dnf install openssl-devel
sudo dnf install libcurl-devel
sudo dnf install libsodium-devel
sudo dnf install openssl-devel
不知道为什么,但我的Jupyter没有给出完整的错误信息,即使与verbose = TRUeinstall.packages("curl", verbose = TRUE, dependencies = TRUE),但R在终端更清楚一点。
不确定是否有办法自动获取R包的系统依赖项。

相关问题