Skip to content

Issues using renv in docker image with a volume mount #1050

Description

@ramnathv

@kevinushey I am running RStudio Server in a docker image with a volume mount. When I log in to RStudio, .libPaths() links to two libaries, a /usr/local/lib/R/site-library which holds the custom packages installed during the docker build and a usr/local/lib/R/library which holds the base+recommended packages that ship with R. In order to have access to the custom packages as well, I initialize renv in my project directory using:

renv::init(settings = list(external.libraries = "/usr/local/lib/R/site-library"))

After initialization, when I try to load packages that are compiled (e.g. rappdirs, yaml etc), I run into the following error, which I believe is because of the cache being in a volume mount with noexec permissions.

Error: package or namespace load failed for ‘rappdirs’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/home/ramnath/.cache/R/renv/cache/v5/R-4.2/x86_64-pc-linux-gnu/rappdirs/0.3.3/5e3c5dc0b071b21fa128676560dbe94d/rappdirs/libs/rappdirs.so':
  /home/ramnath/.cache/R/renv/cache/v5/R-4.2/x86_64-pc-linux-gnu/rappdirs/0.3.3/5e3c5dc0b071b21fa128676560dbe94d/rappdirs/libs/rappdirs.so: failed to map segment from shared object

If I remove the offending packages from the cache folder, they load correctly, as they now load from the external library.

My question is what is considered best-practice in handling such a situation. Is there a way I can tell renv NOT to copy some packages to the cache? I searched around for mounting a volume with exec permissions, but could not find a reasonable approach to do that. I would love to get some pointers on how to approach this. Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions