Skip to content

Crash when loading torch in RStudio #273

Description

@caewok

Attempting to load torch (pytorch.org) using the reticulate package in RStudio Server results in a hard crash (probably a segfault). The same does not happen using R from the terminal. (BTW, loading other python modules works fine in RStudio Server.)

I am running Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-137-generic x86_64), with RStudio Server 1.1.383 and Microsoft R Open 3.4.2. I am using reticulate 1.7.

sessionInfo():

R version 3.4.2 (2017-09-28)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.5 LTS

Matrix products: default
BLAS: /opt/microsoft/ropen/3.4.2/lib64/R/lib/libRblas.so
LAPACK: /opt/microsoft/ropen/3.4.2/lib64/R/lib/libRlapack.so

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] reticulate_1.7 RevoUtils_10.0.6 RevoUtilsMath_10.0.1

loaded via a namespace (and not attached):
[1] compiler_3.4.2 Matrix_1.2-11 tools_3.4.2 yaml_2.1.13 Rcpp_0.12.12 grid_3.4.2
[7] jsonlite_1.5 lattice_0.20-35

py_config() returns:

python: /home/caewok/anaconda2/bin/python
libpython: /home/caewok/anaconda2/lib/libpython2.7.so
pythonhome: /home/caewok/anaconda2:/home/caewok/anaconda2
version: 2.7.14 |Anaconda, Inc.| (default, Dec 7 2017, 17:05:42) [GCC 7.2.0]
numpy: /home/caewok/anaconda2/lib/python2.7/site-packages/numpy
numpy_version: 1.14.0

python versions found:
/home/caewok/.virtualenvs/r-reticulate/bin/python
/usr/bin/python
/usr/bin/python3
/home/caewok/.virtualenvs/r-test-gan-v/bin/python
/home/caewok/anaconda2/bin/python
/home/caewok/miniconda2/bin/python

Running Microsoft R Open 3.4.2 in the terminal with the following works, but running the same in RStudio Server crashes ("The previous R session was abnormally terminated due to an unexpected crash.") :

library(reticulate)
torch <- import("torch")  

Same for this:

library(reticulate)
conda_create("r-test-conda")
use_condaenv("r-test-conda")
torch <- import("torch")

And same for this:

library(reticulate)
virtualenv_create("r-test-v")
use_virtualenv("r-test-v")
torch <- import("torch")

Suggestions are most appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions