Error installing R packages on GitLab CI

5

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

My code for the gitlab-ci.yml file 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

    
asked by anonymous 19.12.2016 / 15:45

1 answer

0

When I try to run the part of R of the code you shared (below), I get a syntax error. This is because in *.yml indentation is important. job did not even begin.

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

This GitLab CI configuration is invalid: jobs: test config can not be blank

Correcting the problem with the job runs, but does not find R and fails.

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

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

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

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

For a list of the various R images in docker, see this address .

The history of builds made for this response can be viewed here .

    
11.06.2018 / 23:03