Search code examples
rsegmentation-faultcoredump

R crashes immediately on startup : caught segfault, address (nil), cause 'memory not mapped'


I recently installed R via conda install -c conda-forge r-base, but it crashes as soon as I try to launch it from terminal (see below). I've reserved 15G of memory for my session (should be plenty).

Any suggestions would be much appreciated.

(base)~/$ R
R version 4.2.0 (2022-04-22) -- "Vigorous Calisthenics"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: x86_64-conda-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

During startup - Warning message:
Setting LC_CTYPE failed, using "C"

 *** caught segfault ***
address (nil), cause 'memory not mapped'

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Segmentation fault (core dumped)

(base)~/$

Solution

  • This problem seemed to be resolved by adding the following lines to my ~/.bashrc file:

    export LANG=en_US.UTF-8
    export LC_ALL=en_US.UTF-8
    

    I can't explain why.