problems installing the rattle package

I am new to RStudio, so this may be an easy fix. But I have spent hours to install and work the Rattle package. I keep getting the error message "RGtk2 is not available for this version of R". I have the newest version of R on my Windows. Is this package not available anymore? What should I do to get it to work?

That package is no longer in CRAN, try compiling from the GitHub mirror.

remotes::install_github("cran/RGtk2")

Sorry for being a novice user but can you give detailed instructions on how to compile it? Thanks so much.

You only need to have a suitable version of RTools installed in your system and run the command I gave you in my previous answer.

https://cran.r-project.org/bin/windows/Rtools/

Andresrcs, what does it mean when a package is no longer in CRAN? Does this mean the author has removed it? Does it mean there are errors that the author is unwilling to fix?

It doesn't mean anything specific per se but, this is the most common cause.

In an opportunity Im read the this situation is because the author of packages don't update the library, but Im not 100% sure about this.

Hi @andresrcs,
I'm having a problem compiling the RGtk2 package from GitHub (so that I can use the rattle package).

I have rtools42 installed (using all defaults), and the latest version of R and RStudio. I've posted my console output below in case you (or anyone else) can point out what is going wrong and suggest a remedy. I get the same errors using RGui. I'm guessing anyone trying to use rattle on Windows is having the same issue.

R version 4.2.1 (2022-06-23 ucrt) -- "Funny-Looking Kid"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (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.

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.

> library(rattle)
Loading required package: tibble
Loading required package: bitops
Rattle: A free graphical interface for data science with R.
Version 5.5.1 Copyright (c) 2006-2021 Togaware Pty Ltd.
Type 'rattle()' to shake, rattle, and roll your data.
> rattle()
Error in rattle() : 
The RGtk2 package is not available but is required. 
Please install the package using, for example: 

  install.packages("RGtk2")

> library(remotes)
> remotes::install_github("cran/RGtk2")
Downloading GitHub repo cran/RGtk2@HEAD
✔  checking for file 'C:\Users\david\AppData\Local\Temp\RtmpWq8CGS\remotes1be0274273c9\cran-RGtk2-27f9198/DESCRIPTION' ...
─  preparing 'RGtk2': (30s)
✔  checking DESCRIPTION meta-information ...
─  cleaning src
─  checking for LF line-endings in source and make files and shell scripts (9.1s)
─  checking for empty or unneeded directories (889ms)
─  building 'RGtk2_2.20.36.2.tar.gz' (575ms)
   Warning: file 'RGtk2/cleanup' did not have execute permissions: corrected
   Warning: file 'RGtk2/configure' did not have execute permissions: corrected
   
Installing package into ‘C:/Users/david/AppData/Local/R/win-library/4.2’
(as ‘lib’ is unspecified)
* installing *source* package 'RGtk2' ...
** using staged installation
** libs
gcc  -I"C:/PROGRA~1/R/R-42~1.1/include" -DNDEBUG -D_R_=1 -DUSE_R=1 -mms-bitfields -I/include/gtk-2.0 -I/lib/gtk-2.0/include -I/include/atk-1.0 -I/include/cairo -I/include/pango-1.0 -I/include/glib-2.0 -I/lib/glib-2.0/include -I/include/libxml2  -I/include/gdk-pixbuf-2.0 -I/include -I. -DR_LEGACY_S_DEFS=1    -I"C:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c RGtkDataFrame.c -o RGtkDataFrame.o
In file included from ./RGtk2/atk.h:4,
                 from RGtk2/gtk.h:4,
                 from RGtkDataFrame.h:1,
                 from RGtkDataFrame.c:1:
./RGtk2/gobject.h:7:10: fatal error: glib.h: No such file or directory
    7 | #include <glib.h>
      |          ^~~~~~~~
compilation terminated.
make: *** [C:/PROGRA~1/R/R-42~1.1/etc/x64/Makeconf:253: RGtkDataFrame.o] Error 1
ERROR: compilation failed for package 'RGtk2'
* removing 'C:/Users/david/AppData/Local/R/win-library/4.2/RGtk2'
Warning message:
In i.p(...) :
  installation of package ‘C:/Users/david/AppData/Local/Temp/RtmpWq8CGS/file1be03ddb4f38/RGtk2_2.20.36.2.tar.gz’ had non-zero exit status

> sessionInfo()
R version 4.2.1 (2022-06-23 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22000)

Matrix products: default

locale:
[1] LC_COLLATE=English_Australia.utf8  LC_CTYPE=English_Australia.utf8   
[3] LC_MONETARY=English_Australia.utf8 LC_NUMERIC=C                      
[5] LC_TIME=English_Australia.utf8    

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

other attached packages:
[1] remotes_2.4.2 rattle_5.5.1  bitops_1.0-7  tibble_3.1.8 

loaded via a namespace (and not attached):
 [1] prettyunits_1.1.1 ps_1.7.1          fansi_1.0.3       rprojroot_2.0.3  
 [5] withr_2.5.0       crayon_1.5.1      utf8_1.2.2        R6_2.5.1         
 [9] lifecycle_1.0.1   magrittr_2.0.3    pillar_1.8.1      rlang_1.0.4      
[13] stringi_1.7.8     cli_3.3.0         curl_4.3.2        rstudioapi_0.14  
[17] callr_3.7.2       vctrs_0.4.1       tools_4.2.1       glue_1.6.2       
[21] processx_3.7.0    compiler_4.2.1    pkgconfig_2.0.3   pkgbuild_1.3.1  

> RStudio.Version()$version
[1] ‘2022.7.1.554’
> 

glib is a library from GTK+ and RGtk2 is a wrapper for the GTK+ graphical user interface library. Do you have GTK+ installed in your system?

Hi @andresrcs,
Still no luck.
I did have GTK installed but I tried reinstallation using MSYS2.
Unfortunately, the compilation error is the same.
The glib.h file is on my system at:
C:\rtools42\x86_64-w64-mingw32.static.posix\include\glib-2.0\glib.h
but it seems that the compiler is being told to find it at
C:\rtools42\x86_64-w64-mingw32.static.posix\include\glib.h

I have no idea how to overcome that.
Any suggestions gratefully received.

1 Like

No, sorry, the only workaround I can think of is to install an older R version and use the last binary the author provided. It seems a lot of effort for a GUI though.

1 Like

I tried installing older versions of R until I found the version where this package works. R 4.1.2 worked for me. But I heard some others had to try even older versions. So try and see...

well... I was able to install and use rattle with R4.1.2 version. But for some reason it stopped working. When I try to re-install it, now I get messages to use R4.1.3 version. I use this version and follow the instructions on https://rattle.togaware.com/ but I get this error message. What am I doing wrong? and why did I lose my rattle in the first place? Any suggestions?

Loading required package: tibble
Error: package or namespace load failed for ‘tibble’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
there is no package called ‘rlang’
Error: package ‘tibble’ could not be loaded

Well, for this particular error message, try installing the missing package

install.packages("rlang")

If that doesn't solve your issue, please post the specific error messages you get

I did install the rlang package and tried rattle again. This time it is saying "tibble" package is required. I tried installing it with install.pacakages("tibble") and I got the following. Any other suggestions?

library(rattle)
Loading required package: tibble
Error: package or namespace load failed for ‘tibble’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘lifecycle’
Error: package ‘tibble’ could not be loaded
install.packages("tibble")
Installing package into ‘C:/Users/alpayn/Documents/R/win-library/4.1’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/tibble_3.1.8.zip'
Content type 'application/zip' length 745833 bytes (728 KB)
downloaded 728 KB

package ‘tibble’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
C:\Users\alpayn\Documents\RtmpA3IcZ1\downloaded_packages

library(rattle)
Loading required package: tibble
Error: package or namespace load failed for ‘tibble’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘lifecycle’
Error: package ‘tibble’ could not be loaded

Keep installing the missing packages

install.packages("lifecycle")

Have in mind that on Windows each R version has an independent package library so you have to reinstall all the packages you need.