-
Notifications
You must be signed in to change notification settings - Fork 285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Running install.packages("usethis") results in "fatal error: 'git2.h' file not found". #1970
Comments
FWIW this is a failure to install the gert package, from source. Installing usethis is what caused you to discover this, but you would presumably get the same result with a direct I would zoom out a bit and ask some questions:
Here's a write-up of why we advise against homebrew for installing R: If you still want to use it for installing R, it's very important to do |
Thank you very much for pointing those issues out for me and those
questions were very useful informative as well. I will reinstall.
Best,
Mark
…On Mon, Apr 1, 2024 at 6:34 PM Jennifer (Jenny) Bryan < ***@***.***> wrote:
FWIW this is a failure to install the gert package, from source.
Installing usethis is what caused you to discover this, but you would
presumably get the same result with a direct install.packages("gert"),
i.e. this doesn't have anything to do with usethis.
I would zoom out a bit and ask some questions:
- Why is install.packages() trying to install source packages instead
of binary? You really shouldn't be trying to build gert unless you really
want to, i.e. you should be installing the prebuild macOS binary from CRAN.
- How did you install R from homebrew? In general, I advise against
homebrew R unless you have very specific reasons you want to do that.
Instead I strongly advise installing R from CRAN (
https://cran.r-project.org/) or with rig (https://github.com/r-lib/rig
).
Here's a write-up of why we advise against homebrew for installing R:
https://github.com/rstats-wtf/what-they-forgot/blob/8205e16230ca8458c461405b43afdc0450bae584/system-prep-for-build.qmd#L69-L91
If you still want to use it for installing R, it's very important to do brew
install --cask r and not brew install r.
—
Reply to this email directly, view it on GitHub
<#1970 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BD4HUUJOQA6RX5HB4CV3JTLY3IDI5AVCNFSM6AAAAABFSNW2D6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZQHEYTKNZYHE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
On a MacOS using homebrew, install libgit2: |
This issue appears very similar to this one written about on March 29, 2021 #1410 (comment) but I'm not doing anything with Github Actions, I'm just trying to install usethis. Based on the 2021 issue it appears that I should install libgit2 as the other advice of waiting for a new cran build doesn't make sense since the R version Angel Food Cake would have correct this error. I also pasted my console below. Can someone please kindly give me a clue on how to get past this?
Lastly, I'm sorry in advance if this isn't the right place or if I'm missing something obvious.
SYSTEM DETAILS
Computer: Macbook Air
Memory: 8GB
Chip: Apple M1
Sonoma 14.2.1
git version 2.39.3 (Apple Git-146)
Homebrew 4.2.16
/opt/brew/opt/pkg-config (appears installed here)
Rstudio: Version 2023.03.1+446 (2023.03.1+446)
R version 4.3.3
ERROR DETAILS
R version 4.3.3 (2024-02-29) -- "Angel Food Cake"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin23.2.0 (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.
[Workspace loaded from ~/.RData]
trying URL 'https://cran.rstudio.com/src/contrib/gert_2.0.1.tar.gz'
Content type 'application/x-gzip' length 122723 bytes (119 KB)
downloaded 119 KB
trying URL 'https://cran.rstudio.com/src/contrib/usethis_2.2.3.tar.gz'
Content type 'application/x-gzip' length 371088 bytes (362 KB)
downloaded 362 KB
** package ‘gert’ successfully unpacked and MD5 sums checked
** using staged installation
Homebrew 4.2.16
Using PKG_CFLAGS=-I/opt/homebrew/opt/libgit2/include
Using PKG_LIBS=-L/opt/homebrew/opt/libgit2/lib -lgit2
----------------------------- ANTICONF -------------------------------
Configuration failed to find libgit2 library. Try installing:
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] ---------------------------
:1:10: fatal error: 'git2.h' file not found
#include <git2.h>
^~~~~~~~
1 error generated.
ERROR: configuration failed for package ‘gert’
Warning in install.packages :
installation of package ‘gert’ had non-zero exit status
ERROR: dependency ‘gert’ is not available for package ‘usethis’
Warning in install.packages :
installation of package ‘usethis’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/2x/ynk03js54vx7vv8wgbyyzr7h0000gn/T/RtmpTuO3yB/downloaded_packages’
The text was updated successfully, but these errors were encountered: