简体   繁体   中英

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.

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")

I was having the exact same problem this morning. My co-worker shared his method of using R in jupypter on google cloud. In case it helps:

Create a regular compute instance, then install conda, and run the following commands:

conda create --name r_3 r-base r-essentials r-devtools jupyterlab r-devtools

conda activate r_3

nohup jupyter lab --no-browser --port=12345 --ip='0.0.0.0' &

on google cloud shell

gcloud compute ssh --project "your-project-name" --zone "your-zone" "your-instance-name" -- -L 12345:localhost:12345 -4

then click the link to the jupyter notebook after running:

tail nohup.out

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM