Search code examples
rgoogle-cloud-platformgcp-ai-platform-notebook

How to get write access to the library folder in AI Platform R 3.6 notebook instance in Google Cloud


I am having trouble installing R packages in JupyterLab in AI Platform on Google Cloud. I am the owner of the project I work in. I have created a new R 3.6 instance with the permission set to the default Compute Engine default service account.

The issue is that I for some reason do not have write access for the folder where packages are saved even though I am project owner and therefore should have write access to everything in the project.

Here is what I have tried and the error message I get:

install.packages("RCurl", repos='http://cran.us.r-project.org')

And this is the error message I get:

Warning message in install.packages("RCurl", repos = "http://cran.us.r-project.org"):
“'lib = "/opt/conda/lib/R/library"' is not writable”
Error in install.packages("RCurl", repos = "http://cran.us.r-project.org"): unable to install packages
Traceback:

1. install.packages("RCurl", repos = "http://cran.us.r-project.org")
2. stop("unable to install packages")

I have tried with both setting the repos argument and not setting it.


Solution

  • By design the default jupyter user does not have the root access because you are supposed to install packages locally. For example (be aware that you can replace /tmp with a local directory): install.packages("leaflet", lib="/tmp")