digitalDLSorteR is based on Deep Neural Network (DNN) models. To use them, keras package (available on CRAN), a high-level neural networks API implemented in Python, is used. keras R package works as an interface between these two languages by using the reticulate package. Therefore, keras requires a Python interpreter to work. We recommend using conda environments to provide a Python interpreter with all its dependencies covered. If you already have a conda environment compatible with keras requirements, the package is supposed to find it automatically during the installation. Otherwise, keras will create a new environment called r-reticulate with all these dependencies covered. There are other ways to install a functionally back-end and customized installations are possible, see and for more details.

In addition, digitalDLSorteR provides the installTFpython function, a helper function to install miniconda (if needed) and create a conda environment called digitaldlsorter-env with all dependencies covered (a Python interpreter with tensorflow >= 2.2). We recommend using installTFpython to install tensorFlow Python library.

installTFpython(install.conda = TRUE)

Common errors with keras

keras package does not find any functional Python environment

If you experiment errors related to its installation and/or keras is not able to find a functional Python environment, you can manually install the conda environment by following these steps:

First, in case you don’t have miniconda installed, use the following R code using reticulate:

  envname = "digitaldlsorter-env", 
  packages = "python==3.7.11"

Or type in a Terminal:

conda create --name digitaldlsorter-env python=3.7 tensorflow=2.1

Then, instead of using keras::install_keras() function, run the following code chunk using the tensorflow R package. This code will create a Python interpreter with tensorflow with all its dependencies covered.

  method = "conda", 
  conda = reticulate::conda_binary("auto"), 
  envname = "digitaldlsorter-env", 
  version = "2.1.0-cpu",

Finally, although it is automatically done by digitalDLSorteR, if keras still does not recognize the functional environment, set this new environment as the selected Python environment:


If the Python-interpreter problems do not disappear, it is possible to set manually the interpreter that will be used with reticulate. See the following guide: And of course, don’t hesitate to tell us your problem, we’ll try to help you.

Eager execution

Depending on tensorflow version used as back-end, you are likely to experiment an error related to eager execution. Eager execution is an imperative, define-by-run interface where operations are executed immediately as they are called. However, it is only available on tensorflow versions later than 1.9. You can disable this option by the following line of code or change your tensorflow version used as back-end.