Error: unable to load R code in package 'graphics' when compiling R 3.6.0 on Linux
Asked Answered
P

1

10

I'm encountering a bug when building R on the amazonlinux:2018.03.0.20190212 docker image in bitbucket pipelines. The strange thing is if I run an EC2 (Amazon Linux 2018) I can run the exact same commands with no error.

Does anyone know how to solve this?

make[6]: Entering directory `/opt/R/src/library/graphics/src'
mkdir -p -- ../../../../library/graphics/libs
make[6]: Leaving directory `/opt/R/src/library/graphics/src'
make[5]: Leaving directory `/opt/R/src/library/graphics/src'
make[4]: Leaving directory `/opt/R/src/library/graphics'
make[4]: Entering directory `/opt/R/src/library/graphics'
byte-compiling package 'graphics'
Error : .onLoad failed in loadNamespace() for 'utils', details:
  call: system(paste(which, shQuote(names[i])), intern = TRUE, ignore.stderr = TRUE)
  error: error in running command
Error: unable to load R code in package 'graphics'
Execution halted

Manually, on EC2:

make[6]: Leaving directory `/opt/R/src/library/graphics/src'
make[5]: Leaving directory `/opt/R/src/library/graphics/src'
make[4]: Leaving directory `/opt/R/src/library/graphics'
make[4]: Entering directory `/opt/R/src/library/graphics'
byte-compiling package 'graphics'
make[4]: Leaving directory `/opt/R/src/library/graphics'
make[3]: Leaving directory `/opt/R/src/library/graphics'
make[3]: Entering directory `/opt/R/src/library/stats'
building package 'stats'

I'm not too familiar with R and don't find the error messages particularly informative.

Poppo answered 4/6, 2019 at 19:8 Comment(4)
Try reinstalling graphic package and the dependencies. remove.packages("graphics") and install.packages("graphics",dependencies=TRUE)Fiddlededee
I get very similar behaviour compiling 3.6.0 on a CentOS cluster.Planetarium
I know it might be simple answer that you are not looking for, yet worth mentioning. If the R version number is not that critical to your business task, then you might want to try a little earlier version than 3.6.0 :)Wallack
@KrassiEm yes, I was able to workaround by using an earlier version of the package that depended on 3.6. No issues with earlier R version. It is just strange that it should fail in pipelines/docker container and not on EC2 with same (evidently not exact same) configuration.Poppo
P
9

I had the same issue, though not with Docker but with Singularity. For me it turned out that I was missing the 'which' binary from the container. After installing the 'which' package (I'm on CentOS7) and I was able to progress passed that error.

Penetrating answered 22/1, 2020 at 17:45 Comment(1)
which is also missing from amazonlinux:2 -- adding it removed this issue.Nether

© 2022 - 2024 — McMap. All rights reserved.