Keras crash in rstudio server GUI, not on command line

Background
I am running Rstudio-server (open source) v1.2.5036 on an Enterprise Linux Red Hat 7 machine. My R version is 3.6.2 and is configured to use Intel's MKL BLAS. I have installed keras with a tensorflow-gpu backend (using library(keras); install_keras(tensorflow = 'gpu'). Note that at the time of writing this post, these versions represent the most up-to-date versions, and on my Arch Linux home server, the same versions work without any problems.

Problem description and steps to reproduce
I am able to load keras in both the Rstudio-server GUI as well as on command line (using SSH). However, Rstudio-server (to be specific: the rsession it spawned) immediately crashes when performing any keras operation, e.g. k <- backend() or model <- keras_model_sequential(). Typically, I get no error message, but instead the GUI just hangs until I restart the session.
Both of these operations work as expected in a command line R environment, and my GPU is initialized correctly by tensorflow.

Further details
The output of reticulate::py_config() is the same for Rstudio-server and command line R:

python: /home/fstruebi/.local/share/r-miniconda/envs/r-reticulate/bin/python
libpython: /home/fstruebi/.local/share/r-miniconda/envs/r-reticulate/lib/libpython3.6m.so
pythonhome: /home/fstruebi/.local/share/r-miniconda/envs/r-reticulate:/home/fstruebi/.local/share/r-miniconda/envs/r-reticulate
version: 3.6.7 | packaged by conda-forge | (default, Nov 6 2019, 16:19:42) [GCC 7.3.0]
numpy: /home/fstruebi/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages/numpy
numpy_version: 1.17.3

Troubleshooting steps undertaken to this point

  • I have reinstalled tensorflow and keras
  • To exclude that this issue had anything to do with my PATH, I have attempted to copy the environmental variables as displayed by Sys.getenv() from the command line R version to R_HOME/etc/Renviron.site. Even though the variables did show up as changed in the Rstudio-server environment, this did not solve my problem.

** Similar questions **

Any ideas on how to solve this? Thanks much for any input!

In case anyone ever encounters this issue:
I managed to solve the problem described above by deleting the precompiled RHEL7 binaries from yum and re-compiling rstudio-server from source following the instructions found here.
:v:t2:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.