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

纵然是瞬间 提交于 2020-08-09 09:20:00

问题


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.


回答1:


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




回答2:


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


来源:https://stackoverflow.com/questions/61224647/how-to-get-write-access-to-the-library-folder-in-ai-platform-r-3-6-notebook-inst

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!