r-lib / gert

Simple git client for R
https://docs.ropensci.org/gert/
Other
148 stars 32 forks source link

Installation Failure Under R 4.0.3 on RHEL 7.9 #107

Closed ferricoxide closed 3 years ago

ferricoxide commented 3 years ago

Hello:

It looks like there may be an issue with this module. When I try to install the devtools modules, it has a dependency on the usethis module which, in turn, has a dependency on gert. A few weeks ago, prior to the 1.0.1 → 1.0.2 update, installing devtools from CRAN worked without issue under R 4.0.3. However, when I tried to do a monthly update of our build, I'm now getting errors. I'm installing using:

/opt/R/4.0.3/bin/Rscript --slave --no-save --no-restore-history \
  -e "install.packages(pkgs='devtools', repos=c('http://cran.us.r-project.org'))"

On Red Hat 7.9. The installation starts out with the message:

        also installing the dependencies 'utf8', 'sys', 'BH', 'pillar', 'pkgconfig', 'vctrs', 'askpass', 'credentials', 'zip', 'gitcreds', 'ini', 'lazyeval', 'base64enc', 'later', 'highr', 'markdown', 'xfun', 'diffobj', 'rematch2', 'tibble', 'clipr', 'crayon', 'curl', 'fs', 'gert', 'gh', 'glue', 'lifecycle', 'purrr', 'rappdirs', 'rprojroot', 'whisker', 'yaml', 'processx', 'R6', 'assertthat', 'fansi', 'digest', 'rex', 'htmltools', 'htmlwidgets', 'magrittr', 'crosstalk', 'promises', 'mime', 'openssl', 'prettyunits', 'xopen', 'brew', 'commonmark', 'knitr', 'Rcpp', 'stringi', 'stringr', 'xml2', 'brio', 'evaluate', 'praise', 'ps', 'waldo', 'usethis', 'callr', 'cli', 'covr', 'desc', 'DT', 'ellipsis', 'httr', 'jsonlite', 'memoise', 'pkgbuild', 'pkgload', 'rcmdcheck', 'remotes', 'rlang', 'roxygen2', 'rstudioapi', 'rversions', 'sessioninfo', 'testthat', 'withr'

When it gets down to the part where the gert (indirect) dependency is being resolved, the error:

        * installing *source* package 'gert' ...
        ** package 'gert' successfully unpacked and MD5 sums checked
        ** using staged installation
        ERROR: configuration failed for package 'gert'
        * removing '/opt/R/4.0.3/lib/R/library/gert'

Is printed. This is later followed by:

        Making 'packages.html' ... done
        ERROR: dependency 'gert' is not available for package 'usethis'
        * removing '/opt/R/4.0.3/lib/R/library/usethis'

And ultimately:

        * installing *source* package 'testthat' ...
        ** package 'testthat' successfully unpacked and MD5 sums checked
        ** using staged installation
        ** libs
        installing to /opt/R/4.0.3/lib/R/library/00LOCK-testthat/00new/testthat/libs
        ** R
        ** inst
        ** byte-compile and prepare package for lazy loading
        ** help
        *** installing help indices
            finding HTML links ... done
        *** copying figures
        ** building package indices
        ** installing vignettes
        ** testing if installed package can be loaded from temporary location
        ** checking absolute paths in shared objects and dynamic libraries
        ** testing if installed package can be loaded from final location
        ** testing if installed package keeps a record of temporary installation path
        * DONE (testthat)
        Making 'packages.html' ... done
        ERROR: dependency 'usethis' is not available for package 'devtools'
        * removing '/opt/R/4.0.3/lib/R/library/devtools'

        The downloaded source packages are in
        \t'/tmp/RtmpRcxdZw/downloaded_packages'
        Updating HTML index of packages in '.Library'
        Making 'packages.html' ... done
        Warning messages:
        1: In install.packages(pkgs = \"devtools\", repos = c(\"http://cran.us.r-project.org\")) :
          installation of package 'gert' had non-zero exit status
        2: In install.packages(pkgs = \"devtools\", repos = c(\"http://cran.us.r-project.org\")) :
        3: In install.packages(pkgs = \"devtools\", repos = c(\"http://cran.us.r-project.org\")) :
          installation of package 'devtools' had non-zero exit status

Is there any way to produce more-useful diagnostics to produce a more-useful issue-report?

ferricoxide commented 3 years ago

This may be a "never mind":

Ran the R-4.0.3 installer with just gert as my module to install. Looks like there's now a need for libgit2-devel on RHEL 7 that I hadn't previously run into. Testing, now to verify.

jennybc commented 3 years ago

I believe this is documented in the README here:

https://github.com/r-lib/gert#installation

(but it sounds like the exact fix didn't bubble up to you until you were installing only gert)

jamesgolden1 commented 3 years ago

Hello, I am having a similar issue with installing devtools in R 3.6.3 on Amazon AWS Linux (which I realize is a special case). As above, this was working a few weeks ago prior to the gert update.

Here is the error I get:

also installing the dependencies ‘gert’, ‘usethis’

Warning message in install.packages("devtools"):
“installation of package ‘gert’ had non-zero exit status”Warning message in install.packages("devtools"):
“installation of package ‘usethis’ had non-zero exit status”Warning message in install.packages("devtools"):
“installation of package ‘devtools’ had non-zero exit status”Updating HTML index of packages in '.Library'
Making 'packages.html' ... done

I am also unable to install gert alone:

Warning message in install.packages("gert"):
“installation of package ‘gert’ had non-zero exit status”Updating HTML index of packages in '.Library'
Making 'packages.html' ... done

I was able to install the libgit2-devel package, but the errors remain. There is a very similar issue on stackoverflow, where they get a more verbose error from miniconda. Do you have any suggestions for configuring git2r?

configure: Package dependency requirement 'libgit2 >= 0.26.0' could not be satisfied.

  -----------------------------------------------------------------------

   Unable to find the libgit2 library on this system. Building 'git2r'
   using the bundled source of the libgit2 library.

   To build git2r with a system installation of libgit2, please install:
     libgit2-dev   (package on e.g. Debian and Ubuntu)
     libgit2-devel (package on e.g. Fedora, CentOS and RHEL)
     libgit2       (Homebrew package on OS X)
   and try again.

   If the libgit2 library is installed on your system but the git2r
   configuration is unable to find it, you can specify the include and
   lib path to libgit2 with:

   given you downloaded a tar-gz archive:
   R CMD INSTALL git2r-.tar.gz --configure-vars='INCLUDE_DIR=/path/to/include LIB_DIR=/path/to/lib'

   or cloned the GitHub git2r repository into a directory:
   R CMD INSTALL git2r/ --configure-vars='INCLUDE_DIR=/path/to/include LIB_DIR=/path/to/lib'

   or download and install git2r in R using
   install.packages('git2r', type='source', configure.vars='LIB_DIR=-L/path/to/libs INCLUDE_DIR=-I/path/to/headers')

   On macOS, another possibility is to let the configuration
   automatically download the libgit2 library from the Homebrew
   package manager with:

   R CMD INSTALL git2r-.tar.gz --configure-vars='autobrew=yes'
   or
   R CMD INSTALL git2r/ --configure-vars='autobrew=yes'
   or
   install.packages('git2r', type='source', configure.vars='autobrew=yes')
jeroen commented 3 years ago

You seem to be confusing the gert package with the git2r package. Also it is not clear if you are using anaconda or another build of R.

If you use anaconda I think you need to conda install -c conda-forge r-gert.

If you do not use anaconda, you need to yum install libgit2-devel and after that in R: install.packages("gert"). If that doesn't work, please include the output of the latter, and also your sessionInfo()

jasonheffner commented 3 years ago

I ran into the same issue with an automated weekly build and had to add libgit2-dev and libcurl4-gnutls-dev, and remove libcurl4-openssl-dev on Ubuntu 18.04 because of library conflicts.

jeroen commented 3 years ago

@jasonheffner you can also use the ppa to avoid the conflict, see the readme.

jasonheffner commented 3 years ago

@jeroen Thanks, I'll keep that as an option in case we run into issues. I see they have the ppa also for bionic.

dgarrimar commented 3 years ago

I am using rocker (https://hub.docker.com/r/rocker/r-ver) with R 3.5.2 and ran into the same issue when trying to install gert. However I could not solve it. I tried adding libgit2-dev and libcurl4-gnutls-dev (and removing libcurl4-openssl-dev).

Here is my Dockerfile:

FROM rocker/r-ver:3.5.2

RUN apt-get update --fix-missing -qq && apt-get install -y -q \
       libssl-dev \
       libcurl4-gnutls-dev \
       libgit2-dev \
    && apt-get clean \
    && apt-get purge \
    && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

RUN R -e 'install.packages(c("gert"), repos="http://cloud.r-project.org/")'

Here is the error I get:

* installing *source* package ‘gert’ ...
** package ‘gert’ successfully unpacked and MD5 sums checked
Using PKG_CFLAGS=
Using PKG_LIBS=-lgit2
WARNING: your version of libgit2 is really old! HTTPS / SSH might not work
Configuration OK!
** libs
rm -f gert.so branch.o clone.o commit.o config.o conflicts.o files.o init.o merge.o rebase.o stash.o tag.o utils.o version.o
gcc -I"/usr/local/lib/R/include" -DNDEBUG -DR_NO_REMAP -DSTRICT_R_HEADERS  -I/usr/local/include  -fvisibility=hidden -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c branch.c -o branch.o
gcc -I"/usr/local/lib/R/include" -DNDEBUG -DR_NO_REMAP -DSTRICT_R_HEADERS  -I/usr/local/include  -fvisibility=hidden -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c clone.c -o clone.o
clone.c: In function ‘R_git_remote_ls’:
clone.c:436:11: error: too many arguments to function ‘git_remote_connect’
   bail_if(git_remote_connect(remote, GIT_DIRECTION_FETCH, &callbacks, NULL, NULL), "git_remote_connect");
           ^~~~~~~~~~~~~~~~~~
In file included from /usr/include/git2/clone.h:14:0,
                 from /usr/include/git2.h:19,
                 from utils.h:1,
                 from clone.c:6:
/usr/include/git2/remote.h:247:17: note: declared here
 GIT_EXTERN(int) git_remote_connect(git_remote *remote, git_direction direction, const git_remote_callbacks *callbacks, const git_strarray *custom_headers);
                 ^~~~~~~~~~~~~~~~~~
make: *** [clone.o] Error 1
/usr/local/lib/R/etc/Makeconf:162: recipe for target 'clone.o' failed
ERROR: compilation failed for package ‘gert’
* removing ‘/usr/local/lib/R/site-library/gert’

I tried via the ppa and it did not work either (although I think this is only available for ubuntu).

Any hint? Thanks!

jasonheffner commented 3 years ago

I tested quickly and the Dockerfile above seems to build fine .. perhaps try with --no-cache?

dgarrimar commented 3 years ago

Still failing with --no-cache. I managed to get it working but compiling libgit2 from source:

RUN git clone --depth=1 -b v1.0.0 https://github.com/libgit2/libgit2.git ~/libgit2_src \
    && cd ~/libgit2_src \
    && cmake . -DBUILD_CLAR=OFF -DCMAKE_BUILD_TYPE=Release -DEMBED_SSH_PATH=~/libssh2_src -DCMAKE_INSTALL_PREFIX=~/libgit2 \
    && cmake --build . --target install \
    && cp -r ~/libgit2/* /usr/bin \
    && cp -r ~/libgit2/* /usr/local

(previously adding to apt-get install the dependencies cmake, pkg-config and git )

ferricoxide commented 3 years ago

I believe this is documented in the README here:

https://github.com/r-lib/gert#installation

(but it sounds like the exact fix didn't bubble up to you until you were installing only gert)

Bingo. It was a dependency to devtools via usethis. Two layers deep. =)

AlonSpitz commented 3 years ago

I am on macOS Big Sur. Managed to install devtools after running:

  1. brew install libgit2
  2. restarting R
  3. install.packages("gert")
  4. install.packages("devtools", dependencies = TRUE)
bisarulhasan commented 2 years ago

On macOS Big Sur, this worked for me on typing these in terminal: 1) brew update 2) brew upgrade 3) brew install libgit2 4) pip3 install pygit2 5) brew install libxml2 6) install.packages("gert") 7) install.packages("devtools", dependencies = TRUE)