更新后显示 ggplot 时 R 崩溃(进程内存读取超出范围) [英] R crashing while displaying ggplot after update (process memory read out of range)

查看:97
本文介绍了更新后显示 ggplot 时 R 崩溃(进程内存读取超出范围)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚更新到 R 4.1.0 并重新安装了我的软件包和 Rstudio(在 Ubuntu 20.04 上).现在,当我尝试制作任何 ggplot 时,R 内存不足并崩溃.错误消息很长,我无法完全读取它,因为 R 会话立即中止,但它提到 缺少 nul 终止符"进程内存读取超出范围" 和一堆 [XXXX:XXXX:YYYYYYYY,ZZZZZZ,AAAAAA ERROR: elf_dynamic_array_reader.h:61] 标签未找到,最后是 [XXXX:XXXX:YYYYYYYY,ZZZZZZ,AAAAAA] ERROR directory_reader_posix.cc:42] opendir: 没有这样的文件或目录 (2)(其中 X、Y、Z 和 A 是数字).

I just updated to R 4.1.0 and re-installed my packages and Rstudio (on Ubuntu 20.04). Now R runs out of memory and crashes when I try to make any ggplot. The error message is long and I can't fully read it because the R session immediately aborts, but it mentions "missing nul terminator", "process memory read out of range" and a bunch of lines of [XXXX:XXXX:YYYYYYYY,ZZZZZZ,AAAAAA ERROR: elf_dynamic_array_reader.h:61] tag not found and finally [XXXX:XXXX:YYYYYYYY,ZZZZZZ,AAAAAA] ERROR directory_reader_posix.cc:42] opendir: No such file or directory (2) (where X, Y, Z, and A are numbers).

我最初在我的数据中遇到此错误,但似乎任何 ggplot 都会发生此错误:

I originally got this error with my data but it seems to happen with any ggplot:

library(ggplot2)

ggplot(mtcars, aes(x = cyl, y = mpg)) + geom_boxplot()

我认为这与实际显示绘图有关,因为当我将绘图保存到变量中然后 ggsave() 它不会崩溃,并且生成的文件很好.当我在下一行使用 ggsave() 的函数中执行 ggplot(...) 时也可以.

I think it's to do with actually displaying the plot because it doesn't crash when I save the plot into a variable and then ggsave() it, and the resulting file is fine. It's also OK when I do ggplot(...) within a function with ggsave() in the next line.

基本 R 中的相同绘图工作正常.

The same plot in base R works fine.

boxplot(mpg~cyl, data = mtcars) 

==>在绘图窗格中显示箱线图

==> displays boxplot in the Plots pane

使用 install.packages() 重新安装 ggplot2 没有解决问题,我尝试 sudo apt install ./rstudio-1.4.1106-amd64.deb再次,但它只是说 Rstudio 已经是最新版本.

Reinstalling ggplot2 with install.packages() didn't fix the problem, and I tried to sudo apt install ./rstudio-1.4.1106-amd64.deb again but it just says Rstudio is already the newest version.

推荐答案

来自 Kevin Ushey 的推文 说:

PSA:如果您是计划升级到 R 4.1.0 的 RStudio 用户,您可能需要安装 RStudio 的预览版 (https://rstudio.com/products/rstudio/download/preview/) -- 否则,当您尝试使用 ggplot2 时,您可能会看到 RStudio 崩溃.

PSA: If you're an RStudio user planning to upgrade to R 4.1.0, you may want to install the preview release of RStudio (https://rstudio.com/products/rstudio/download/preview/) -- otherwise, you may see RStudio crash when you try to use ggplot2.

版本号是1.4.1714-2 预览版",远远领先于您通过 apt 安装的 1.4.1106 版本.该页面上的发行说明包括

The version number is "1.4.1714-2 Preview", so well ahead of the 1.4.1106 version you're installing via apt. Release notes on that page include

支持即将发布的 R 4.1.0 版本,包括新的 |>管道、(x) 函数简写和新的图形引擎.

Support for the upcoming R 4.1.0 release, including the new |> pipe, (x) function shorthand, and new graphics engine.

另一种选择是降级 R 到旧版本;对于 Windows,4.0.5 二进制文件似乎可用 此处.不幸的是,MacOS 下载页面 似乎只在以前的版本中提供 3.6.3(不是任何 4.0.x 版本)——感觉降级还有很长的路要走.

Another alternative would be to downgrade R to an older version; for Windows the 4.0.5 binary appears to be available here. Unfortunately, the MacOS download page only appears to offer 3.6.3 in previous versions (not any 4.0.x releases) — which feels like a long way to downgrade.

这篇关于更新后显示 ggplot 时 R 崩溃(进程内存读取超出范围)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆