更新到最新的 Rstudio 版本后 ggplot 出现致命错误

Fatal error with ggplot after updating to latest Rstudio version

最近,在启动 Rstudio v1.3 Apricot Nasturtium 时,控制台中出现一条消息警告:

R graphics engine version 14 is not supported by this version of RStudio. The Plots tab will be disabled until a newer version of RStudio is installed.

我通过下载 Ubuntu 18/Debian 10 deb 文件和 运行

安装了最新版本的 Rstudio(v1.4.1106,Tiger Daylily)

sudo apt install ~/Downloads/rstudio-1.4.1106-amd64.deb

为了测试绘图选项卡,我 运行

plot(sample.int(20), sample.int(20))

工作没有问题。然后我通过 运行

测试了 ggplot
library(ggplot2)
library(tidyverse)
test_df <- data.frame(test_x=sample.int(20), test_y=sample.int(20))
test_df %>% ggplot(aes(x=test_x, y=test_y)) + geom_point()

并出现致命错误并显示以下错误消息:

[438609:438609:20210601,170114.000291:ERROR process_memory_range.cc:86] read out of range [438609:438609:20210601,170114.000338:ERROR elf_image_reader.cc:558] missing nul-terminator [438609:438609:20210601,170114.000475:ERROR elf_dynamic_array_reader.h:61] tag not found [438609:438609:20210601,170114.003921:ERROR elf_dynamic_array_reader.h:61] tag not found [438609:438609:20210601,170114.003979:ERROR elf_dynamic_array_reader.h:61] tag not found [438609:438609:20210601,170114.004031:ERROR elf_dynamic_array_reader.h:61] tag not found [438609:438609:20210601,170114.004084:ERROR elf_dynamic_array_reader.h:61] tag not found [438609:438609:20210601,170114.004135:ERROR elf_dynamic_array_reader.h:61] tag not found [438609:438609:20210601,170114.004198:ERROR elf_dynamic_array_reader.h:61] tag not found [438609:438609:20210601,170114.004660:ERROR elf_dynamic_array_reader.h:61] tag not found [438609:438609:20210601,170114.004711:ERROR elf_dynamic_array_reader.h:61] tag not found [438609:438609:20210601,170114.005227:ERROR elf_dynamic_array_reader.h:61] tag not found [438609:438609:20210601,170114.005297:ERROR elf_dynamic_array_reader.h:61] tag not found [438609:438609:20210601,170114.005351:ERROR elf_dynamic_array_reader.h:61] tag not found [438609:438609:20210601,170114.005412:ERROR elf_dynamic_array_reader.h:61] tag not found [438609:438609:20210601,170114.005464:ERROR elf_dynamic_array_reader.h:61] tag not found [438609:438609:20210601,170114.005516:ERROR elf_dynamic_array_reader.h:61] tag not found [438609:438609:20210601,170114.005564:ERROR elf_dynamic_array_reader.h:61] tag not found [438609:438609:20210601,170114.005617:ERROR elf_dynamic_array_reader.h:61] tag not found [438609:438609:20210601,170114.005666:ERROR elf_dynamic_array_reader.h:61] tag not found [438609:438609:20210601,170114.005717:ERROR elf_dynamic_array_reader.h:61] tag not found [438609:438609:20210601,170114.005874:ERROR elf_dynamic_array_reader.h:61] tag not found [438609:438609:20210601,170114.005925:ERROR elf_dynamic_array_reader.h:61] tag not found [438609:438609:20210601,170114.005978:ERROR elf_dynamic_array_reader.h:61] tag not found [438609:438609:20210601,170114.006021:ERROR elf_dynamic_array_reader.h:61] tag not found [438609:438609:20210601,170114.006077:ERROR elf_dynamic_array_reader.h:61] tag not found [438609:438609:20210601,170114.006124:ERROR elf_dynamic_array_reader.h:61] tag not found [438609:438609:20210601,170114.006176:ERROR elf_dynamic_array_reader.h:61] tag not found [438609:438609:20210601,170114.006228:ERROR elf_dynamic_array_reader.h:61] tag not found [438609:438609:20210601,170114.006284:ERROR elf_dynamic_array_reader.h:61] tag not found [438609:438609:20210601,170114.006336:ERROR elf_dynamic_array_reader.h:61] tag not found [438609:438609:20210601,170114.006386:ERROR elf_dynamic_array_reader.h:61] tag not found [438609:438609:20210601,170114.006439:ERROR elf_dynamic_array_reader.h:61] tag not found [438609:438609:20210601,170114.006552:ERROR elf_dynamic_array_reader.h:61] tag not found [438609:438609:20210601,170114.006614:ERROR elf_dynamic_array_reader.h:61] tag not found [438609:438609:20210601,170114.008365:ERROR elf_dynamic_array_reader.h:61] tag not found [438609:438609:20210601,170114.011795:ERROR directory_reader_posix.cc:42] opendir: No such file or directory (2)

我尝试卸载并重新安装 Rstudio v1.4.1106,但问题仍然存在。 在 this post 之后,我尝试安装 nvidia 430 驱动程序

sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
sudo apt install nvidia-driver-430 nvidia-settings

但是 Rstudio 在尝试 ggplot 命令时遇到同样的致命错误。

我当前的规格是 Rstudio v1.4.1106 和 R v4.1.0,在 Dell XPS 15 7590 运行 Ubuntu 20.04.2 LTS 上 显卡是 NVIDIA Corporation TU117M [GeForce GTX 1650 Mobile / Max-Q]。

所以这似乎是 ggplot 和最新版本的 RStudio 的问题。目前正在等待官方修复,但同时 运行 X11() 在每个 ggplot 命令起作用之前,将图形后端切换到 'agg'。

我目前正在使用 'agg' 解决方法,因为它对我来说比 X11() 修复更容易。