Workspace base project and reticulate install for all members

Hi, I would like to set up my class workspace on an organisation account so that all students will have access to reticulate and its python dependencies. When I install reticulate and Minconda on the base project, a new project cannot find available python. Is there a place on the workspace I can point reticulate towards to access python?
The below chunk on a new project in the workspace returns FALSE

library(reticulate)
library(tidyverse)
py_available(initialize = TRUE)

Hi Barry,

I suspect the issue is that by default miniconda gets installed to your user's home directly (/home/rstudio-user), which is not shared when another user creates a project using your template (this is because it can contain private information like SSH keys). The fix would be to install miniconda under the /cloud/project directory, which will be copied.

-Andy

Hi Andy, I think I have done this on the base project? Here is what I have done:

#install.packages("remotes")
setwd("/cloud/project")
reticulate::install_miniconda("miniconda")
Sys.setenv(WORKON_HOME = "virtualenvs")
reticulate::virtualenv_create("r-reticulate", python = "miniconda/bin/python")
keras::install_keras(
  method = "virtualenv",
  conda = "miniconda/bin/conda",
  envname = "r-reticulate",
  tensorflow = "1.13.1",
  restart_session = FALSE
)
line <- "WORKON_HOME=/cloud/project/virtualenvs"
writeLines(line, ".Renviron")
rstudioapi::restartSession()

Opening a new project does then include the above file structure and files, but when I run both of these commands and check for python availability FALSE is returned.

reticulate::use_virtualenv("r-reticulate")
reticulate::py_available()

reticulate::use_python(python = "miniconda/bin/python")
 reticulate::py_available()

This is the space URL if that helps
https://rstudio.cloud/spaces/212980/project/3520381

I think you need to do something like

reticulate::install_miniconda("/cloud/project/miniconda")

I have not tested this myself.

1 Like

Hi Andy,

Thanks for the swift reply. Is this not what I have done with these lines of code?

setwd("/cloud/project")
reticulate::install_miniconda("miniconda") 

When I create a new project the /miniconda folder does appear in the files but I cannot call it using reticulate.

So it all seems to be working now @andy_kipp. Some magic must have happened overnight!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.