簡體   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