繁体   English   中英

安装包“Rmpfr”在 R 中具有非零退出状态

[英]Installation of package ‘Rmpfr’ had non-zero exit status in R

我无法在 R 中安装 Rmpfr 包。我正在尝试使用 CVXR 包来解决 OR 问题。 由于需要 Rmpfr 包作为先决条件,我尝试使用 install.packages('Rmpfr') 安装相同的包。 我得到的错误是:

错误:dyn.load(文件,DLLpath = DLLpath,...)中“Rmpfr”的包或命名空间加载失败:无法加载共享对象“/home/karunyavenugopalan/R/x86_64-redhat-linux-gnu-library/ 3.6/00LOCK-Rmpfr/00new/Rmpfr/libs/Rmpfr.so':libmpfr.so.6:无法打开共享对象文件:没有这样的文件或目录错误:加载失败执行停止错误:加载失败*删除'/home/ karunyavenugopalan/R/x86_64-redhat-linux-gnu-library/3.6/Rmpfr' install.packages 中的警告:安装包 'Rmpfr' 的退出状态非零

操作系统:Fedora 31 RStudio 版本:1.2.5019

我已经使用 yum install mpfr-devel 安装了 mpfr

请协助。

如果您浏览CRAN 存储库的Rmpfr部分,您会注意到这个包需要gmpmpfr作为系统要求,然后再安装 R 包。

在 Fedora 30 上对我有用的是我确保安装了 -devel 版本,所以:

sudo dnf install gmp-devel mpfr-devel

首先我尝试安装软件包:

$ R

R version 3.6.1 (2019-07-05) -- "Action of the Toes"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-redhat-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> install.packages("Rmpfr")
Installing package into ‘/home/romunov/R/x86_64-redhat-linux-gnu-library/3.6’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
also installing the dependency ‘gmp’

trying URL 'https://cran.wu.ac.at/src/contrib/gmp_0.5-13.5.tar.gz'
Content type 'application/x-gzip' length 133364 bytes (130 KB)
==================================================
downloaded 130 KB

trying URL 'https://cran.wu.ac.at/src/contrib/Rmpfr_0.7-2.tar.gz'
Content type 'application/x-gzip' length 626031 bytes (611 KB)
==================================================
downloaded 611 KB

* installing *source* package ‘gmp’ ...
** package ‘gmp’ successfully unpacked and MD5 sums checked
** using staged installation
creating cache ./config.cache
checking for __gmpz_ui_sub in -lgmp... no
configure: error: GNU MP not found, or not 4.1.4 or up, see http://gmplib.org
ERROR: configuration failed for package ‘gmp’
* removing ‘/home/romunov/R/x86_64-redhat-linux-gnu-library/3.6/gmp’
ERROR: dependency ‘gmp’ is not available for package ‘Rmpfr’
* removing ‘/home/romunov/R/x86_64-redhat-linux-gnu-library/3.6/Rmpfr’

The downloaded source packages are in
    ‘/tmp/RtmpstRn5N/downloaded_packages’
Warning messages:
1: In install.packages("Rmpfr") :
  installation of package ‘gmp’ had non-zero exit status
2: In install.packages("Rmpfr") :
  installation of package ‘Rmpfr’ had non-zero exit status

安装gmp-devel

$ sudo dnf install gmp-devel
Last metadata expiration check: 0:59:19 ago on Tue 24 Dec 2019 09:44:08 AM CET.
Dependencies resolved.
=========================================================================================================================================================================
 Package                                 Architecture                         Version                                         Repository                            Size
=========================================================================================================================================================================
Installing:
 gmp-devel                               x86_64                               1:6.1.2-10.fc30                                 fedora                               173 k
Installing dependencies:
 gmp-c++                                 x86_64                               1:6.1.2-10.fc30                                 fedora                                17 k

Transaction Summary
=========================================================================================================================================================================
Install  2 Packages

Total download size: 191 k
Installed size: 402 k
Is this ok [y/N]: y
Downloading Packages:
(1/2): gmp-c++-6.1.2-10.fc30.x86_64.rpm                                                                                                   36 kB/s |  17 kB     00:00    
(2/2): gmp-devel-6.1.2-10.fc30.x86_64.rpm                                                                                                214 kB/s | 173 kB     00:00    
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                    107 kB/s | 191 kB     00:01     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                 1/1 
  Installing       : gmp-c++-1:6.1.2-10.fc30.x86_64                                                                                                                  1/2 
  Installing       : gmp-devel-1:6.1.2-10.fc30.x86_64                                                                                                                2/2 
  Running scriptlet: gmp-devel-1:6.1.2-10.fc30.x86_64                                                                                                                2/2 
  Verifying        : gmp-c++-1:6.1.2-10.fc30.x86_64                                                                                                                  1/2 
  Verifying        : gmp-devel-1:6.1.2-10.fc30.x86_64                                                                                                                2/2 

Installed:
  gmp-devel-1:6.1.2-10.fc30.x86_64                                                     gmp-c++-1:6.1.2-10.fc30.x86_64                                                    

Complete!

哎呀,还不够。

> install.packages("Rmpfr")
Installing package into ‘/home/romunov/R/x86_64-redhat-linux-gnu-library/3.6’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
also installing the dependency ‘gmp’

trying URL 'https://cran.wu.ac.at/src/contrib/gmp_0.5-13.5.tar.gz'
Content type 'application/x-gzip' length 133364 bytes (130 KB)
==================================================
downloaded 130 KB

trying URL 'https://cran.wu.ac.at/src/contrib/Rmpfr_0.7-2.tar.gz'
Content type 'application/x-gzip' length 626031 bytes (611 KB)
==================================================
downloaded 611 KB

* installing *source* package ‘gmp’ ...
** package ‘gmp’ successfully unpacked and MD5 sums checked
** using staged installation
creating cache ./config.cache
checking for __gmpz_ui_sub in -lgmp... yes
updating cache ./config.cache
creating ./config.status
creating src/Makevars
** libs
g++ -m64 -std=gnu++11 -I"/usr/include/R" -DNDEBUG -I/usr/local/include/    -I/usr/local/include  -fpic  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection  -c apply.cc -o apply.o
...
checking mpfr.h presence... no
checking for mpfr.h... no
configure: error: Header file mpfr.h not found; maybe use --with-mpfr-include=INCLUDE_PATH
ERROR: configuration failed for package ‘Rmpfr’
* removing ‘/home/romunov/R/x86_64-redhat-linux-gnu-library/3.6/Rmpfr’

The downloaded source packages are in
    ‘/tmp/Rtmpaz2MNH/downloaded_packages’
Warning message:
In install.packages("Rmpfr") :
  installation of package ‘Rmpfr’ had non-zero exit status

安装mpfr-devel

$ sudo dnf install mpfr-devel
Fedora Modular 30 - x86_64                                                                                                                21 kB/s |  23 kB     00:01    
Fedora Modular 30 - x86_64 - Updates                                                                                                      32 kB/s |  22 kB     00:00    
Fedora 30 - x86_64 - Updates                                                                                                              28 kB/s |  22 kB     00:00    
Fedora 30 - x86_64                                                                                                                        18 kB/s |  23 kB     00:01    
google-chrome-beta                                                                                                                        16 kB/s | 1.3 kB     00:00    
google-chrome                                                                                                                            3.4 kB/s | 1.3 kB     00:00    
RPM Fusion for Fedora 30 - Free - Updates                                                                                                 61 kB/s |  10 kB     00:00    
RPM Fusion for Fedora 30 - Free                                                                                                           12 kB/s |  10 kB     00:00    
RPM Fusion for Fedora 30 - Nonfree - Steam                                                                                                54 kB/s | 9.6 kB     00:00    
RPM Fusion for Fedora 30 - Nonfree - Updates                                                                                              51 kB/s |  10 kB     00:00    
RPM Fusion for Fedora 30 - Nonfree                                                                                                        61 kB/s |  11 kB     00:00    
Dependencies resolved.
=========================================================================================================================================================================
 Package                                   Architecture                          Version                                     Repository                             Size
=========================================================================================================================================================================
Installing:
 mpfr-devel                                x86_64                                3.1.6-4.fc30                                fedora                                 76 k

Transaction Summary
=========================================================================================================================================================================
Install  1 Package

Total download size: 76 k
Installed size: 122 k
Is this ok [y/N]: y
Downloading Packages:
mpfr-devel-3.1.6-4.fc30.x86_64.rpm                                                                                                       283 kB/s |  76 kB     00:00    
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                     66 kB/s |  76 kB     00:01     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                 1/1 
  Installing       : mpfr-devel-3.1.6-4.fc30.x86_64                                                                                                                  1/1 
  Running scriptlet: mpfr-devel-3.1.6-4.fc30.x86_64                                                                                                                  1/1 
  Verifying        : mpfr-devel-3.1.6-4.fc30.x86_64                                                                                                                  1/1 

Installed:
  mpfr-devel-3.1.6-4.fc30.x86_64                                                                                                                                         

Complete!

再试一次

> install.packages("Rmpfr")
Installing package into ‘/home/romunov/R/x86_64-redhat-linux-gnu-library/3.6’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
trying URL 'https://cran.wu.ac.at/src/contrib/Rmpfr_0.7-2.tar.gz'
Content type 'application/x-gzip' length 626031 bytes (611 KB)
==================================================
downloaded 611 KB

* installing *source* package ‘Rmpfr’ ...
** package ‘Rmpfr’ successfully unpacked and MD5 sums checked
** using staged installation
checking for gcc... gcc -m64
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -m64 accepts -g... yes
...
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (Rmpfr)

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

Ubuntu 解决方案的更新:

sudo apt install libgmp-dev
sudo apt-get install libmpfr-dev

之后,您可以在 R 中运行:

install.packages('gmp')
install.packages('Rmpfr')

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM