最近在更新一个R包的时候,发生了如下所示的报错:
```
3: In install.packages(update[instlib == l, “Package”], l, repos = repos, :
installation of package ‘ hdf5r ’ had non-zero exit status
4: In install.packages(update[instlib == l, “Package”], l, repos = repos, :
installation of package ‘ RcppArmadillo ’ had non-zero exit status
既然 hdf5r 和 RcppArmadillo包报错了,就先安装它们,首先是hdf5r , 第一次尝试安装它:
BiocManager::install(‘hdf5r’)
‘getOption(“repos”)’ replaces Bioconductor standard repositories, see ‘?repositories’ for details
replacement repositories:
CRAN: https://cran.rstudio.com/
Bioconductor version 3.11 (BiocManager 1.30.12), R 4.0.2 (2020-06-22)
Installing package(s) ‘hdf5r’
There is a binary version available but the source version is later:
binary source needs_compilation
hdf5r 1.3.2 1.3.3 TRUE
在这里不小心选择了yes
Do you want to install from sources the package which needs compilation? (Yes/no/cancel) yes
installing the source package ‘hdf5r’
然后可怕的事情就出来了:
configure: error: hdf5 does not seem to be installed on your platform.
Please install the hdf5 library.
The required HDF5 library files can be installed as follows:
- Debian-based (e.g. Debian >= 8.0, Ubuntu >= 15.04): ‘sudo apt-get install libhdf5-dev’
- Old Debian-based (e.g Debian < 8.0, Ubuntu < 15.04): Install from source (see INSTALL)
- OS X using Homebrew: ‘brew install hdf5’
- RPM-based (e.g Fedora): ‘sudo yum install hdf5-devel’
ERROR: configuration failed for package ‘hdf5r’- removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/hdf5r’
- restoring previous ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/hdf5r’
```
我看了看我的系统,再次尝试 brew install hdf5 ,然后又是一堆报错:
==> Summary
/usr/local/Cellar/gcc/10.2.0_4: 1,465 files, 339.5MB
==> Installing hdf5 dependency: szip
==> Pouring szip--2.1.1_1.big_sur.bottle.tar.gz
/usr/local/Cellar/szip/2.1.1_1: 11 files, 143.1KB
==> Installing hdf5
==> Pouring hdf5--1.12.0_3.big_sur.bottle.tar.gz
Error: Permission denied @ apply2files - /usr/local/lib/docker/cli-plugins
在这样的报错的纠结中,我回忆起来了以前其实遇到过这样的问题:
Do you want to install from sources the package which needs compilation? (Yes/no/cancel) no
trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.0/hdf5r_1.3.2.tgz'
Content type 'application/x-gzip' length 5041178 bytes (4.8 MB)
==================================================
downloaded 4.8 MB
The downloaded binary packages are in
/var/folders/2x/l4fzfvy17gz94j1sz6klhyjh0000gn/T//RtmpeVVDPq/downloaded_packages
Old packages: 'hdf5r', 'RcppArmadillo'
Update all/some/none? [a/s/n]:
n
> library(hdf5r)
Attaching package: ‘hdf5r’
也就是说在最开始面临是否编译的选择,只需要 选择no就好了 :
- Do you want to install from sources the package which needs compilation? (Yes/no/cancel)