Using RStudio Cloud Install while Waiting on M1 Fix

I teach using the fabulous greta package. While the install process is greatly simplified these days for most users, users with M1 chips are not easily supported (correct me if I am wrong here).

So, my M1 students use RStudio cloud. Since, the typical greta install process (install_greta_deps() ) does not work on the cloud, use the below script to setup a new project on RStudio Cloud with a working greta install. (WARNING: MAKE SURE YOU OVERRIDE PROJECTS DEFAULT RAM TO BE 4GB OR MORE DURING INSTALL OR INSTALL PROCESS WILL BE KILLED WITHOUT HELPFUL MESSAGING FROM THE CONSOLE.)

[CORRECTION: TYPICAL INSTALL PROCESS DOES SEEM TO WORK ON CLOUD AS LONG AS YOU HAVE 4GB RAM OR MORE IGNORE BELOW SCRIPT AND FOLLOW TYPICAL INSTALL INSTRUCTIONS … I WILL LEAVE THE BELOW SCRIPT IN CASE A MANUAL INSTALL IS REQUIRED IN THE FUTURE]

Here’s the script that works for me:

### SETUP AN RSTUDIO CLOUD ACCOUNT with >4GB RAM!
### AT https://rstudio.cloud/, THEN USE
### THIS INSTALL SCRIPT FOR INSTALLING
### CAUSACT,GRETA,TENSORFLOW ON RSTUDIO CLOUD

## NOTE:  Run each line one at a time using CTRL+ENTER.
##        Await completion of one line
##        before running the next.
##        If prompted to "Restart R", say YES.

## Get R's reticulate package (<1 minute)
install.packages("reticulate")

## Use reticulate to configure python (<1 minute)
reticulate::install_miniconda()
## Need >4GB RAM for this part (i.e. paid plan or instructor-supplied RAM resources)
## (~4 minutes to run below)
reticulate::conda_create(envname = "greta-env",
                         packages = c("python=3.7","tensorflow=1.14","pyyaml",
                                      "requests","Pillow", "pip","numpy=1.16",
                                      "h5py=2.8","tensorflow-probability=0.7"))

## Get R packages
install.packages("greta")

## TEST SCRIPT
library(greta) 
model(normal(0,1))
## if NO ERRORS (warnings are okay), then installation is a success
# Typically shows the below output: 
# ✔ Initialising python and checking dependencies ... done!               
# greta model
## NEVER RUN THIS INSTALL SCRIPT AGAIN OR YOU RISK MUCKING UP YOUR INSTALL

## CHANGE RSTUDIO RAM BACK TO 1GB TO Avoid Excessive Charges
1 Like

Thanks so much for this @ajf!

The next release of greta should include a manual install option like this: https://github.com/greta-dev/greta/blob/9f33fe02a0cbede26dca517f343e5e95762dc53b/R/install_greta_deps.R#L70-L79

Which should helpfully help resolve these issues - at that point however we should be a place where greta M1 works. We are getting closer and closer with these and i’m trying to more clearly document where we are at with TF2 and M1 issues - the new TF2 label should help flag these, if you’re interested in tracking progress: https://github.com/greta-dev/greta/issues?q=is%3Aissue+is%3Aopen+label%3ATF2

Sorry to hear that install_greta_deps() doesn’t work out of the box, in the past with rstudio cloud we’ve found (once we increase to 4Gb RAM) that install_greta_deps() worked, but that was about a year ago so things may well have changed!

Again thanks for sharing your experience and work arounds for installation, we really really appreciate this feedback and contribution!

@njtierney Thanks for the update on the M1 progress!!

Also, install_greta_deps() is working with 4GB ram. FALSE ALARM ON MY PART- sorry for that. I had tested install_greta_deps() with 2GB ram because I thought that used to work, but did not try increasing ram further during my debug process. When I stumbled on the 4GB ram working with my more complicated install script, I failed to revisit install_greta_deps() with 4GB ram.

Thanks to your response, I retract the above misinformation I have put out into the world.

1 Like

No worries at all, @ajf! It’s good to test if things work, I’m glad to hear that install_greta_deps() worked before, and works now, so this is great!

Thanks again for being a great engaged community member, really appreciate your inputs!