2

I have this bug every time I run rattle(), but I can not figure out how to fix it:

> library(rattle)
Rattle: A free graphical interface for data science with R.
Version 5.2.7 Copyright (c) 2006-2018 Togaware Pty Ltd.
Type 'rattle()' to shake, rattle, and roll your data.
>
>
> rattle()
Loading required package: RGtk2
 *** caught segfault ***
address 0x0, cause 'memory not mapped'

Traceback:
 1: .RGtkCall("S_gtk_widget_show", object, PACKAGE = "RGtk2")
 2: method(obj, ...)
 3: crv$rattleGUI$getObject("rattle_window")$show()
 4: rattle()

Greenonline
  • 2,305
  • 11
  • 25
  • 32

2 Answers2

1

You've not stated what OS you're on, but I'm assuming it's Mac because I've seen that exact error happen before on Mac.

Try to install an older version of RGtk2.

You can get old versions here: https://cran.r-project.org/src/contrib/Archive/RGtk2/

To install old versions you should do so via terminal with the command.

R CMD INSTALL ~/[Path to package]/RGtk2_[Version].tar.gz

For more information on RGtk2 issues you can visit: https://gist.github.com/sebkopf/9405675

Noel
  • 11
1

I have it working on OS X 13.6, using, R 4.02, RGtk2 version 2.20.361 and gtk+ version 2.24.32_3 (installed via homebrew):

==> Downloading https://homebrew.bintray.com/bottles/gtk%2B-2.24.32_3.high_sierr

...

==> Pouring gtk+-2.24.32_3.high_sierra.bottle.1.tar.gz /usr/local/Cellar/gtk+/2.24.32_3: 1,194 files, 59.9MB

After installation,

> library(rattle)
Loading required package: tibble
Loading required package: bitops
Rattle: A free graphical interface for data science with R.
Version 5.4.0 Copyright (c) 2006-2020 Togaware Pty Ltd.
Type 'rattle()' to shake, rattle, and roll your data.
> rattle()
Loading required package: RGtk2
> 

Screenshot of rattle() in R


See also Error in installing packages 'RGtk2' and 'rattle' in R, for other working version combinations of R, RGtk2 and rattle.

To determine which version of gtk+ you have installed, use:

# brew list --versions gtk+
gtk+ 2.24.32_3

To determine which version of RGtk2 you have:

> ip <- as.data.frame(installed.packages()[,c(1,3:4)])
> rownames(ip) <- NULL
> ip <- ip[is.na(ip$Priority),1:2,drop=FALSE]
> print(ip, row.names=FALSE)
         Package   Version
              BH  1.72.0-3

...

       RGtk2   2.20.36


For completeness, this was the procedure I followed (adapted from Erin Lun's guide listed in Rattle: Installation on Macintosh OS X (Leopard and Lion)):

brew install r
brew install gtk+
uninstall --force cairo --ignore-dependencies
brew cask install xquartz
brew install cairo
R
> install.packages("RGtk2", dependencies = T)
> install.packages("cairoDevice", dependencies = T)
> install.packages("rattle", dependencies = T)
> q()
R
> library(rattle)
> rattle()

Note: I found that the suggested command brew install --with-x11 cairo gave me an error (Error: invalid option: –with-x11)


Also useful

Footnotes

1 The version of RGtk2 can not be the issue, as this question on SO, RStudio1.2.1335 quits when calling rattle() ver 2.5.0 due to RGtk2 2.20.36 using Mojave, is also using v. 2.20.36.

Greenonline
  • 2,305
  • 11
  • 25
  • 32