Hi Ziqian_Xia,
I believe I was able to get this to work with the following steps: Starting with a new project using 2GB memory and 1.5 CPU, I used these steps from Sam's workaround:
library(reticulate)
library(keras)
virtualenv_create("myenv")
use_virtualenv("myenv")
install_keras(method="virtualenv", envname="myenv")
Now after you see the message "Restarting R session..." but before you try to use Keras, run use_virtualenv("myenv")
a second time. I believe the virtualenv was deactivated when the R session was restarted.
After I ran these steps I was able to do:
library(keras)
mnist <- dataset_mnist()
x_train <- mnist$train$x
y_train <- mnist$train$y
x_test <- mnist$test$x
etc
I was not prompted to install miniconda and I can use the mnist dataset.
I hope that works for you.
Best,
Ming
Edit: here is my full console history starting from the new project
install.packages('reticulate')
install.packages('keras')
library(reticulate)
library(keras)
virtualenv_create("myenv")
use_virtualenv("myenv")
install_keras(method="virtualenv", envname="myenv")
use_virtualenv("myenv")
library(keras)
mnist <- dataset_mnist()
x_train <- mnist$train$x