Error with MNIST_CNN example



I attempted the mnist_cnn example found on the rstudio page (here).

The lines I ran were


# Data Preparation -----------------------------------------------------

batch_size <- 128
num_classes <- 10
epochs <- 12

# Input image dimensions
img_rows <- 28
img_cols <- 28

# The data, shuffled and split between train and test sets
mnist <- dataset_mnist()

on the last line I get the following error:

/home/alex/.virtualenvs/r-tensorflow/bin/python: error while loading shared libraries: cannot open shared object file: No such file or directory
Error: error in running command

I attempted some advice from stackoverflow, but had no luck. I am still getting the same error. What should I do to debug this?


Looking at the install_keras() documentation. I say that I could install via conda as opposed to virtualenv. With that knowledge I did the following:

  1. remove.packages("keras")
  2. install miniconda (instructions here)
  3. install_keras(method = "conda", conda = "auto")

Everything works fine now.