我无法在R中安装Rmpfr软件包,我试图使用CVXR软件包来解决OR问题。因为Rmpfr包是必需的,所以我尝试使用install.packages('Rmpfr')安装相同的包。我得到的错误是:
错误:dyn.load中的“Rmpfr”包或命名空间加载失败(文件,DLLpath = DLLpath,):无法加载共享对象'/home/karunyavenugopalan/R/x86_64-redhat-linux-gnu-library/3.6/00LOCK-Rmpfr/00new/Rmpfr/libs/Rmpfr.so':libmpfr.so.6:无法打开共享对象文件:没有此类文件或目录错误:加载失败执行暂停错误:加载失败*删除install.packages中的‘/home/karunyavenugopalan/R/x86_64-redhat-linux-gnu-library/3.6/Rmpfr’警告:安装包‘Rmpfr’具有非零退出状态 操作系统: Fedora 31 RStudio verion: 1.2.5019
我已经使用yum安装mpfr-devel安装了mpfr。
请协助。
发布于 2019-12-24 09:52:50
如果您浏览到CRAN存储库的Rmpfr部分,您会注意到这个包需要在安装R包之前安装gmp
和mpfr
作为系统需求。
在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’
发布于 2022-01-14 18:03:55
具有Ubuntu解决方案的更新:
sudo apt install libgmp-dev
sudo apt-get install libmpfr-dev
之后,您可以在R中运行:
install.packages('gmp')
install.packages('Rmpfr')
https://stackoverflow.com/questions/59466234
复制相似问题