Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ggplot2 crashes RStudio after upgrading to R 4.1.0 #9373

Closed
PMassicotte opened this issue May 19, 2021 · 41 comments
Closed

ggplot2 crashes RStudio after upgrading to R 4.1.0 #9373

PMassicotte opened this issue May 19, 2021 · 41 comments

Comments

@PMassicotte
Copy link

System details

RStudio Edition : Desktop
RStudio Version : 1.4.1106
OS Version      : Linux Mint 20.1 x86_64
R Version       : 4.1.0

Steps to reproduce the problem

Since I upgraded to R 4.1.0, RStudio crashes when I try to create a ggplot2 graph.

  • It works if I run the code in console, but crashes in RStudio.
  • It also works on daily release of RStudio (but not on stable, 1.4.1106).

Describe the problem in detail

Peek 2021-05-19 07-20

diagnostics-report.txt

  • [ x] I have read the guide for submitting good bug reports.
  • [x ] I have installed the latest version of RStudio, and confirmed that the issue still persists.
  • [ x] If I am reporting an RStudio crash, I have included a diagnostics report.
  • [ x] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
@PMassicotte PMassicotte changed the title ggplot2 crashes after upgrading to R 4.1.0 ggplot2 crashes RStudio after upgrading to R 4.1.0 May 19, 2021
@gusepi-mrk-II
Copy link

RStudio Edition : desktop-bin
RStudio Version : 1.4.1106
OS Version: Arch Linux x86_64
R Version: 4.1.0

I am experiencing this exact same problem. I have tried the following (without success):

  1. Uninstalled and re-installed ggplot2
  2. Removed the package rstudio-desktop-bin (1.4.1106-1) and its dependencies, and reinstalled on my machine

@dagdrommer
Copy link

dagdrommer commented May 19, 2021

Studio Edition : desktop-bin
RStudio Version : 1.4.1106
OS Version: Arch Linux x86_64
R Version: 4.1.0

I have the same problem here as well. Same OS, same R and Studio version.
The Arch RStudio install is build with the rstudio-1.4.1106-amd64.deb binaries (so most likely the same as @PMassicotte). I also can confirm that ggplot runs well in the console --> so it is neither a ggplot, nor a r problem.

Downgrading to r-4.0.5-4 solved the issue, but this obviously can't be a long term solution.

Cheers

@gusepi-mrk-II
Copy link

gusepi-mrk-II commented May 19, 2021

Studio Edition : desktop-bin
RStudio Version : 1.4.1106
OS Version: Arch Linux x86_64
R Version: 4.1.0

I have the same problem here as well. Same OS, same R and Studio version. I also can confirm that ggplot runs well in the console --> so it is neither a ggplot, nor an r problem.

Downgrading to r-4.0.5-4 solved the issue, but this obviously can't be a long therm solution.

Cheers

Of course! I'm not sure why I overlooked doing that - thank you for the suggestion.

I have the downgrade (9.0.0-1) utility found on AUR, however, running $ sudo downgrade R returned Unable to downgrade R. I've also tried to change the version using the desktop frontend Global options, but this doesn't seem to be possible.

How did you downgrade R?

@dagdrommer
Copy link

How did you downgrade R?

Very simple, just go to your package cache directory in: /var/cache/pacman/pkg/
look for the name of the r version that was installed before 4.1 (r-4.0.5-4 was the last one in my case)
and then run:
sudo pacman -U /var/cache/pacman/pkg/r-4.0.5-4-x86_64.pkg.tar.zst

see the wiki for more

@famuvie
Copy link

famuvie commented May 19, 2021

Hi. I can confirm the issue in the same environment as the OP.
I also confirm that downgrading R to the previous version (4.0.5) solves the problem.
In Debian and derivatives can be done with:

sudo aptitude install r-base=4.0.5-1.2004.0 r-recommended=4.0.5-1.2004.0 r-base-core=4.0.5-1.2004.0 r-base-dev=4.0.5-1.2004.0

@gusepi-mrk-II
Copy link

How did you downgrade R?

Very simple, just go to your package cache directory in: /var/cache/pacman/pkg/
look for the name of the r version that was installed before 4.1 (r-4.0.5-4 was the last one in my case)
and then run:
sudo pacman -U /var/cache/pacman/pkg/r-4.0.5-4-x86_64.pkg.tar.zst

see the wiki for more

Thank you for the explanation, and the wiki link. It worked, but you're right - this is not a long ter solution.

@ronblum
Copy link
Contributor

ronblum commented May 19, 2021

@PMassicotte Thank you for filing the issue, and everyone for the added information! We don't support Linux Mint or Arch Linux. However, I can reproduce the issue on Ubuntu 20.04. Support for R 4.1.0 is provided in the upcoming Juliet Rose release, so thank you for confirming that it works in the dailies. We now have a preview available at https://www.rstudio.com/products/rstudio/download/preview/ . Caveat: previews are still meant for testing purposes only, but they're fairly stable.

@PMassicotte
Copy link
Author

Thank you, @ronblum , I can confirm that the preview version is working.

@ronblum
Copy link
Contributor

ronblum commented May 19, 2021

@PMassicotte Excellent, I appreciate your test and confirmation!

@MatthieuStigler
Copy link

For future searches, the error is: ERROR elf_dynamic_array_reader.h:61] tag not found

@c-mertes
Copy link

I can also confirm that the preview fixes the issue on CentOS 8.

@lewishooper
Copy link

Downgrading to R 4.05 worked on Ubuntu 20.04 (I was afraid to try the preview as 20.04 wasn't listed only 18.04)
Followed the directions from famvue (see below) but used apt-get instead of aptitude. Worked great. Problem solved

Hi. I can confirm the issue in the same environment as the OP.
I also confirm that downgrading R to the previous version (4.0.5) solves the problem.
In Debian and derivatives can be done with:

sudo aptitude install r-base=4.0.5-1.2004.0 r-recommended=4.0.5-1.2004.0 r-base-core=4.0.5-1.2004.0 r-base-dev=4.0.5-1.2004.0

@Elizemiku
Copy link

Elizemiku commented May 22, 2021

Hello! I have the same problem, as advised downgrading to R 4.05 worked fine on Linux Mint 20.

@gvegayon
Copy link

gvegayon commented May 23, 2021

Just to jump in, I noticed this is an issue with the grid package. Not sure what changed, but simply executing the following crashes RStudio:

grid::grid.newpage()

I can confirm that using the preview version "Juliet Rose" (e7ab0fe, 2021-05-20) RStudio no longer crashes.

Session info

R version 4.1.0 (2021-05-18)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.5 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/atlas/libblas.so.3.10.3
LAPACK: /usr/lib/x86_64-linux-gnu/atlas/liblapack.so.3.10.3

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     

loaded via a namespace (and not attached):
[1] compiler_4.1.0 tools_4.1.0   

RStudio version 1.4.1106

cc @ronblum

@ronblum
Copy link
Contributor

ronblum commented May 24, 2021

@gvegayon Which OS and version of RStudio does this occur in? Is this still a problem in the current 1.4. Juliet Rose preview?

[Note: I can reproduce the problem on Red Hat 7 in RStudio Server 1.4.1106, and everything works fine in 1.4.1714 preview.]

@kevinushey
Copy link
Contributor

To confirm, the issue does effect all packages using grid (which includes ggplot2) and the fix is indeed available in the current preview release of RStudio. https://www.rstudio.com/products/rstudio/download/preview/

@gvegayon
Copy link

To confirm, the issue does effect all packages using grid (which includes ggplot2) and the fix is indeed available in the current preview release of RStudio. https://www.rstudio.com/products/rstudio/download/preview/

Also, although you probably know already, I believe the issue only manifests itself when calling grid::grid.newpage(), i.e., I was able to build grobs and an entire plot, it wasn't until I tried to plot it (calling that function) that it failed.

@pablorm296
Copy link

I can confirm this problem. Here's my session info:

R version 4.1.0 (2021-05-18)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.2 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0

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

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

loaded via a namespace (and not attached):
[1] compiler_4.1.0

I had to switch to VS Code (I noticed that using VS Code or the R terminal, the R session doesn't crash). Can't downgrade in our work servers, since our company's security policy doesn't allow it.

@kevinushey
Copy link
Contributor

@pablorm296: is installing the preview release of RStudio an option? It contains a fix for this issue.

@fenguoerbian
Copy link

If for any reason you can't downgrade R or install preview version of Rstudio, a possible temporary work around is to output the graph to another device, such as a .pdf file.

@dataandcrowd
Copy link

I also encountered the same problem on my Ubuntu machine, but thanks to the people above I was able to solve the issue after installing the preview version rstudio-1.4.1717-amd64.deb on the rstudio website

@Abdinardo
Copy link

Another "solution" is using the x11() command before ggplot() command, like that:
x11(); ggplot(data) + .....

@melissa-barca melissa-barca unpinned this issue May 26, 2021
@usuallycwdillon
Copy link

Another "solution" is using the x11() command before ggplot() command, like that:
x11(); ggplot(data) + .....

This is a much better solution than dropping down to a previous rstudio version, since we're just waiting on a preview release to be approved.

@jmcphers
Copy link
Member

The preview release has now been officially approved (we just don't want to release it before the long weekend in the US). It will become the stable/official build next week, but the bits won't change. 1.4.1717-3 is the final build: https://www.rstudio.com/products/rstudio/download/preview/

@MatthieuStigler
Copy link

@jmcphers great to hear about this!

Confirming also the bug affecting the Server version when running on Ubuntu 18.04, and being fixed in the preview!

@mabba777
Copy link

@PMassicotte Excellent, I appreciate your test and confirmation!

Issue solved with the 1.4.1717-3 preview in Ubuntu 18.04.5 LTS

@ronblum
Copy link
Contributor

ronblum commented Jun 1, 2021

@MatthieuStigler and @mabba777 Thank you for letting us know!

@ziman
Copy link

ziman commented Jun 5, 2021

As a hotfix, switching to the AGG backend in Tools > Global Options > General > Graphics > Backend helps on my machine, too.

Here's an updated PKGBUILD for the fixed version (not updated in AUR yet). I just changed the version number and the SHA256 hash of the DEB file and it seems to work.

@Robinlovelace
Copy link

In case it's of use/interest I've seen a few crashes with ggplot2 code on the latest daily version:

Version 1.5.190

@kevinushey
Copy link
Contributor

@Robinlovelace: if you can, please file a new issue with more details + a reproducible example (even if the example only reproduces occasionally)

@Robinlovelace
Copy link

Hi @kevinushey, it was very intermittent, something like 1 in 5 to 10 plots causing crashing. I recall seeing something along the lines of

ERROR elf_dynamic_array_reader.h:61] tag not found

multiple times behind the 💣 of the RStudio crash. Following info in this thread I've now switched to using ragg as the graphics backend. No more crashes so far... I'm running Ubuntu 20.04 and R 4.1.0. Other than that I'm not sure what else I can do other than switching back to the old graphics device and trying to reproduce it on the medium sized datasets I'm plotting.

@Robinlovelace
Copy link

Robinlovelace commented Jul 12, 2021

Other than that I'm not sure what else I can do other than switching back to the old graphics device and trying to reproduce it on the medium sized datasets I'm plotting.

Not that I'm planning to do that, lots of things on, just commented under this issue after it chimed with my experience and wondering if one of the proposed solutions would work for my case.

@Robinlovelace
Copy link

Just seen a crash on the same version of RStudio using tmap after just switching to interactive view mode:

image

@Robinlovelace
Copy link

Apologies for another update but that version has just crashed with another tmap plot, not in interactive mode.

@Robinlovelace
Copy link

image

@kevinushey
Copy link
Contributor

A reproducible example (something I could copy and paste to try and reproduce) would be helpful.

@Robinlovelace
Copy link

I can provide a reprex, will send an invite to the repo I'm working on now... It involves a bit of data crunching but is reproducible.

@Robinlovelace
Copy link

(Unfortunately I cannot share the code publicly atm.)

@jtlandis
Copy link

jtlandis commented Jan 19, 2022

Hello, I seem to be having this issue as well.

Currently after some debugging I have found that calling grid::grid.newpage() will cause my R session to crash if it is done through Rstudio (server, 1.4.1103 (Wax Begonia) for CentOS 7)

Specifically at a line in the grid namespace ".Call(C_newpage)"

I have confirmed that if I run R through command line, grid::grid.newpage() does not cause the session to crash, so it seems to be related to the RStudio server.

For some additional context I updated the R version to 4.1.2 in December of 2021.

---- EDIT ----

After updating to 2021.09.2+382 (Ghost Orchid) for CentOS 7 I can now use grid::grid.newpage() without issue

@sareinhardt
Copy link

Hello,
I am experiencing the same error. I am sorry for probably not giving the perfect bug report, while I do some social network analysis, I am generally not very code-savvy.
R crashes anytime I use qgraph.
This is my session info

R version 4.2.2 (2022-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)

It happens anytime I run this code:


l <- qgraph.layout.fruchtermanreingold(edges, weights=edges$weight,vcount=vcount(graph_deu))

lm <- qgraph.layout.fruchtermanreingold(edges,vcount=vcount(graph_deu), area=8*(vcount(graph_deu)^2),repulse.rad=(vcount(graph_deu)^3.1))

Or latest, when I try plotting the graph thereafter.

I tried some of the suggested solutions like x11() and switching to AGG backend, but they do not work. I update all packages, too. I would really appreciate any help to solves this, as I urgendtly need to create some graphs for work. Thank you so much and of course I will provide any info that might be helpful.

@bandtank
Copy link

bandtank commented Apr 6, 2023

This is happening for me on M1 OSX 13.3 using R 4.2.3.

Data file

library(RGPR)

amplitude = 0.01
palette = "grey3"
dataPath <- "test-data/"

files <- list.files(
  dataPath,
  pattern = "^.*\\.dzt$",
  ignore.case = TRUE,
  full.names = TRUE
)

for(file in files) {
  gprData <- readGPR(dsn = file)
  fileName <- tools::file_path_sans_ext(basename(file))
  plot(
    gprData,
    col = palGPR(palette),
    xlab="meters",
    ylab="meters",
    clip = amplitude
  )
  q()
}

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests