Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Tensorflow crashes R session with fatal error #6049
Steps to reproduce the problem
Install tensorflow in a fresh environment
RStudio returns message:
Describe the problem in detail
The crash occurs whenever I attempt to use one of the
While the error suggests that this is an R crash, I think it is an RStudio issue because I can put the same commands into a script
I can even run the commands interactively in a plain R session (with RStudio's built-in terminal, even):
Similar to #5406, except reinstalling
I am running RStudio Server in Docker, so none of the instructions for generating a diagnostics report seemed applicable. Happy to do this if someone can tell me how.
Describe the behavior you expected
This issue is very likely to be a crash in Tensorflow or a library that it uses, not RStudio, but we can't be sure without a call stack. Could you get one? Here's how:
Repro'd on RSP 1.2.5033-1, ubuntu 18.04, R 3.6.2, TF2
Running any TF related code, e.g.
Same code runs fine in R through terminal.
Stack trace below
Apologies for the delay, took me a while to figure out how to use
I tested this against today's daily build of RStudio Server (1.3.825) and the crash does not occur.
Unless @jmcphers would like more information, I think this issue can be closed.
# https://rstudio.cloud/project/931550 callr::r(function() tensorflow::tf_config()) #> TensorFlow v2.0.0 () #> Python v3.6 (~/.local/share/r-miniconda/envs/r-reticulate/bin/python) tensorflow::tf_config() #> Crashes R session, sometimes with an explicit message: #> *** Error in /usr/lib/rstudio-server/bin/rsession': munmap_chunk(): invalid pointer: 0x00007ffd59ea4240 ***
Oddly enough though, an equivalent external process with a
library(future) plan(multisession) # Works fine: f <- future("hello world") value(f) # Hangs for a couple minutes and then crashes RStudio: f <- future(tensorflow::tf_config()) value(f)
For onlookers, the solution that worked for me was to downgrade TensorFlow to version 1.13.1 (no need for v2 in my use case). I thought I already tried that, but then I realized
reticulate::install_miniconda("miniconda") Sys.setenv(WORKON_HOME = "virtualenvs") reticulate::virtualenv_create("r-reticulate", python = "miniconda/bin/python") keras::install_keras( method = "virtualenv", conda = "miniconda/bin/conda", envname = "r-reticulate", tensorflow = "1.13.1", restart_session = FALSE ) # Now set WORKON_HOME to the path to virtualenvs in .Renviron