我尝试在miniconda上的R 3.6.1上安装easypackages R包,这需要安装gert包,但失败了。日志如下:
* installing *source* package ‘gert’ ...
** package ‘gert’ successfully unpacked and MD5 sums checked
** using staged installation
Found pkg-config cflags and libs!
Using PKG_CFLAGS=
Using PKG_LIBS=-lgit2
----------------------------- ANTICONF -------------------------------
Configuration failed to find libgit2 library. Try installing:
* brew: libgit2 (MacOS)
* deb: libgit2-dev (Debian, Ubuntu, etc)
* rpm: libgit2-devel (Fedora, CentOS, RHEL)
If libgit2 is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a libgit2.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 MESSAGE] ---------------------------
<stdin>:1:10: fatal error: git2.h: No such file or directory
compilation terminated.
----------------------------------------------------------------------
ERROR: configuration failed for package ‘gert’
* removing ‘/home/dave/miniconda3/envs/r-environment/lib/R/library/gert’
ERROR: dependency ‘gert’ is not available for package ‘usethis’
* removing ‘/home/dave/miniconda3/envs/r-environment/lib/R/library/usethis’
ERROR: dependency ‘usethis’ is not available for package ‘devtools’
* removing ‘/home/dave/miniconda3/envs/r-environment/lib/R/library/devtools’
ERROR: dependency ‘devtools’ is not available for package ‘easypackages’
* removing ‘/home/dave/miniconda3/envs/r-environment/lib/R/library/easypackages’
The downloaded source packages are in
‘/tmp/RtmpsVDMkh/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning messages:
1: In install.packages(new.packages, repos = "http://cran.us.r-project.org") :
installation of package ‘gert’ had non-zero exit status
2: In install.packages(new.packages, repos = "http://cran.us.r-project.org") :
installation of package ‘usethis’ had non-zero exit status
3: In install.packages(new.packages, repos = "http://cran.us.r-project.org") :
installation of package ‘devtools’ had non-zero exit status
4: In install.packages(new.packages, repos = "http://cran.us.r-project.org") :
installation of package ‘easypackages’ had non-zero exit status
Error in library("easypackages") :
there is no package called ‘easypackages’
Execution halted我已经安装了libgit2-dev Ubuntu包,但是它没有解决这个问题。对如何修复有什么建议吗?我使用的是Ubuntu 16.04.7 LTS操作系统。
发布于 2021-09-12 07:30:25
不是Ubuntu的答案,但可能会对其他调试有所帮助。在Mac 10.15.7 Catalina上的R 4.1.1中安装包'devtools‘时出现类似的错误。运行brew install libgit2解决了这个问题。
https://stackoverflow.com/questions/65631688
复制相似问题