dlab-berkeley/R-Deep-Learning

Troubleshooting Missing Python Packages

seanmperez opened this issue · 0 comments

Myself and other participants in the workshop have issues when fitting models using the image_data_generator() function in notebook 2 & 3.

The issues I and other have gotten so far include:

  1. "Error in py_call_impl(callable, dots$args, dots$keywords) : ImportError: Could not import PIL.Image. The use of load_img requires PIL."
  2. "Error in py_call_impl(callable, dots$args, dots$keywords) : ImportError: Could not import PIL.Image. The use of load_img requires PIL."
# For R-Deep-Learning package missing issues when using datagen

# Step 1: Figure out what package is missing, for example: 
#"Error in py_call_impl(callable, dots$args, dots$keywords) : ImportError: Could not import PIL.Image. The use of `load_img` requires PIL."  
# Issue is no python library PIL

# Step 2: Install the library using conda_install() from the reticulate package
library(reticulate)

# install SciPy
conda_install("r-reticulate", "scipy")
# install PIL
conda_install("r-reticulate", "PIL") # replace PIL with whatever python package is missing


# If conda_install() fails try:
py_install("PACKAGE_NAME_HERE")

# Step 3: Restart your R-session and try the code that broke again!

This worked well for most participants.