Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
322 views
in Technique[技术] by (71.8m points)

r - Ubuntu, how to deal the error "<stdin>:1:10: fatal error: git2.h: No such file or directory"?

I am trying to install the easypackages R package on R 3.6.1 on miniconda, which requires the installation of the gert package, that fails. Here's the log:

* 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

I already installed the libgit2-dev Ubuntu package but it did not solve the problem. Any suggestion on how to fix it? I am using an Ubuntu 16.04.7 LTS operating system.

Thank you


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...