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