Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: [ENOENT] Failed to make directory '//.cache/pins' #705

Closed
nick-youngblut opened this issue Feb 3, 2023 · 4 comments
Closed

error: [ENOENT] Failed to make directory '//.cache/pins' #705

nick-youngblut opened this issue Feb 3, 2023 · 4 comments

Comments

@nick-youngblut
Copy link

Issue

Trying to load the pins package via library("pins") results in the error:

Error: package or namespace load failed for ‘pins’:
 .onLoad failed in loadNamespace() for 'pins', details:
  call: NULL
  error: [ENOENT] Failed to make directory '//.cache/pins': no such file or directory
Execution halted

The package is assuming that .cache/pins exists, but it does not in the Docker container from which the code is run. I'm not sure what's going on with the // in '//.cache/pins'.

Reprex

Dockerfile:

FROM rocker/r-ver:4.2.1
MAINTAINER Nicholas Youngblut, Federation Bio, Inc.

# Install R dependencies
RUN install2.r --ncpus 4 --error \
  argparse dplyr tidyr glue DBI RPostgres \
  httr aws.s3 aws.signature rsconnect pins qs && \
  rm -rf /tmp/downloaded_packages

devcontainer:

{
    "name": "nfcore",
    "image": "nfcore/gitpod:2.7.1",
    "postCreateCommand": "bash .devcontainer/setup.sh",
    "remoteUser": "gitpod",
    "customizations": {
        "vscode": {
            "settings": {
                "python.defaultInterpreterPath": "/opt/conda/bin/python",
                "python.linting.enabled": true,
                "python.linting.pylintEnabled": true,
                "python.formatting.autopep8Path": "/opt/conda/bin/autopep8",
                "python.formatting.yapfPath": "/opt/conda/bin/yapf",
                "python.linting.flake8Path": "/opt/conda/bin/flake8",
                "python.linting.pycodestylePath": "/opt/conda/bin/pycodestyle",
                "python.linting.pydocstylePath": "/opt/conda/bin/pydocstyle",
                "python.linting.pylintPath": "/opt/conda/bin/pylint"
            },
            "extensions": ["ms-python.python", "ms-python.vscode-pylance", "REditorSupport.r", "EditorConfig.EditorConfig",
                           "codezombiech.gitignore", "Gruntfuggly.todo-tree", "ms-vsliveshare.vsliveshare",
                           "nextflow.nextflow", "redhat.vscode-yaml", "streetsidesoftware.code-spell-checker"]
        }
	},
	"features": {
		"ghcr.io/devcontainers/features/docker-in-docker:2": {
            "version": "latest"
        },
        "ghcr.io/devcontainers/features/aws-cli:1": {
            "version": "latest"
        }
    }
}

R code:

#!/usr/bin/env Rscript

# library
suppressPackageStartupMessages(library("argparse"))
suppressPackageStartupMessages(library("dplyr"))
suppressPackageStartupMessages(library("tidyr"))
suppressPackageStartupMessages(library("rsconnect"))
suppressPackageStartupMessages(library("pins"))
suppressPackageStartupMessages(library("qs"))
@nick-youngblut
Copy link
Author

nick-youngblut commented Feb 3, 2023

I added to mkdir -p /.cache/pins to my RUN command in my docker file, which just changed the error:

Error: package or namespace load failed for ‘pins’:
 .onLoad failed in loadNamespace() for 'pins', details:
  call: NULL
  error: [EACCES] Failed to make directory '//.cache/pins/local': permission denied

...so I had to open up permissions for /.cache/.

Maybe a vignette on using pins with Docker (& Rocker) could be helpful.

@juliasilge
Copy link
Member

Thanks for reporting your problems @nick-youngblut!

I was trying to reproduce the problem with my typical Docker workflow. First I did this to generate an renv.lock:

renv::snapshot(
  project = NULL,
  lockfile = "renv.lock",
  packages = "pins",
  prompt = FALSE
)

Then I build this Dockerfile:

FROM rocker/r-ver:4.2.1
ENV RENV_CONFIG_REPOS_OVERRIDE https://packagemanager.rstudio.com/cran/latest

RUN apt-get update -qq && apt-get install -y --no-install-recommends \
  libcurl4-openssl-dev \
  libssl-dev \
  make \
  && apt-get clean

COPY renv.lock renv.lock
RUN Rscript -e "install.packages('renv')"
RUN Rscript -e "renv::restore()"
RUN Rscript -e "library(pins)"

That ran without error and then I could do docker run --rm -ti pins-example and run pins in the container.

I also tried this Dockerfile and it also worked fine for me:

FROM rocker/r-ver:4.2.1
ENV RENV_CONFIG_REPOS_OVERRIDE https://packagemanager.rstudio.com/cran/latest

RUN install2.r pins

If you are able to create a minimal example that shows the problem you were experiencing with pins and Docker, we would be happy to check it out!

@nick-youngblut
Copy link
Author

You will probably need to use VS Code with a devcontainer (as shown above) to reproduce the issue.

@github-actions
Copy link

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.

@github-actions github-actions bot locked and limited conversation to collaborators Feb 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants