Error installing R packages in Gitlab CI

Asked

Viewed 119 times

5

When I try to install R packages using shell, the following error occurs:

My code from the archive gitlab-ci.yml is as follows:

before_script:
- export DJANGO_SETTINGS_MODULE= ----
- pip install -r requirements.txt

test:
script:
  - R -e 'install.packages(c("raster", "rgdal"))'
  - R CMD build . --no-build-vignettes --no-manual
  - PKG_FILE_NAME=$(ls -1t *.tar.gz | head -n 1)
  - R CMD check "${PKG_FILE_NAME}" --no-build-vignettes --no-manual
  - pep8 --show-source --show-pep8 setup.py planex tests
  - nosetests

Warning in install.Packages(c("raster", "rgdal")) :

'lib = "/usr/local/lib/R/site-library"' is not writable

Error in install.Packages(c("raster", "rgdal")) :

Unable to install Packages

Execution Halted

ERROR: Build failed: Exit status 1

  • 1

    you have permission to write in this directory? /usr/local/lib/R/site-library

  • drwxrwsr -x 2 root staff 4096 Out5 /usr/local/lib/R/site-Ibary

  • @Guilhermelima, it’s the host gitlab or gitlab.org?

1 answer

1

When trying to rotate the part of R from the code you shared (below), I got a syntax error. This is because in the files *.yml indentation is important. The job hasn’t even started.

test:
script:
  - R -e 'install.packages(c("raster", "rgdal"))’

This Gitlab CI Configuration is invalid: Jobs:test config can’t be Blank

By correcting the problem with identation the job wheel, but does not find the R and failure.

test:
  script:
    - R -e 'install.packages(c("raster", "rgdal"))'

/bin/bash: line 62: R: command not found

Finally, when adding the Docker image from R (r-base), installation of packages ran smoothly.

test:
  image: rocker/r-base
  script:
    - R -e 'install.packages(c("raster", "rgdal"))'

For a list of various images from R on the Docker, see this address.

The builds history made for this answer can be seen here.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.