R Fails After Installing Gtk and Rgtk2

R fails after installing GTK and RGtk2

I want to thank all the people that contributed to a solution of this problem. Eventually I managed to fix it, after numerous trials (and late nights!).
The basic methods that have been proposed are:

  • install GTk+ and cairo with homebrew

  • install GTk2 and cairo with macports

I never managed to make this work with macports, but eventually I've been successful with homebrew, after many fruitless attempts.
I cleaned up my PATH that was getting a bit messy.
Then I basically uninstalled X11, GTk+, cairo and all their dependencies.

I've first installed XQuartz-2.7.4.

For the installation of all the needed components I've followed the instructions found here and installed yarp using homebrew and the associated instructions. Most people may found this bizarre (I did), but installing yarp installed sequentially all the needed dependencies to make GTk+ work (obviously I tried just to install GTk+ and cairo but it never worked or eventually RGTk2 failed to compile).

I then installed (using R CMD INSTALL) GTk2, Cairo, cairoDevice and rattle from sources.
After so many months trying to fix the problem I couldn't believe that everything worked!

Thanks again to all those that contributed with their effort and their research to fix the problem.

Enzo

Error in installing packages 'RGtk2' and 'rattle' in R

One possible solution as mentioned is to install an older version of RGtk2. For Windows this might be:

install.packages("https://cran.r-project.org/bin/windows/contrib/3.3/RGtk2_2.20.31.zip",
repos=NULL)

Further suggestions can be found at https://rattle.togaware.com/rattle-install-troubleshooting.html

System Error after installing R package

Thank you all for your inputs. I managed to figure it out.

The problem arose as a result of missing GTK+ file. I'm not exactly sure what GTK+ really is, but I know that GTK+ is a preliminary file needed to install the Rattle Package. Here's the step I took to download the GTK+ file.

  1. First, remove all the tabs opened in RStudio.
  2. Use install.packages to download Rattle package. A window should pop up asking to see if you want to download GTK+. Click Yes.
  3. Restart RStudio.

Error message installing Rattle for R on macOS 10.14.1

This answer is a distillation of content I originally posted on my Johns Hopkins Data Science Specialization Community Mentor Github site in August 2017, in response to student questions about how to install Rattle on OS X in order to produce fancy rpart plots with rattle::fancyRpartPlot().

The install requires the gtk toolkit, and on the Mac one way to accomplish this is, per R 3.0 and GTK+ / RGTK2 Error:

  1. Install macports — tool for installing mac packages

  2. run SUDO to install gtk2 on mac
    sudo port install gtk2 ## (X11 -- not aqua)
  3. export new path
    export PATH=/opt/local/bin:/opt/local/sbin:$PATH
  4. From command line R, enter install rgtk2 with
    install.packages("RGtk2",type="source") to compile from source

  5. Install the rattle package
    install.packages("rattle",type="source")

NOTE: For the RGtk2 install to work correctly from RStudio, one must first confirm that the PATH change listed above is applied to the shell that is used to start RStudio.

The most complete set of instructions is located at Sebastian Kopf's Gist page and verified by my own install on June 17, 2017. Once installed, loading the rattle library will generate the following output in the R console.

Sample Image

In order to use fancyRpartPlot(), one will also need to install the rpart.plot package.

  install.packages("rpart.plot")

Example: Fancy Rpart Plot of Iris Data

Here we've replicated the code needed to generate a fancy tree diagram with caret and rattle that is discussed in the Johns Hopkins Data Science Specialization Practical Machine Learning lecture on Predicting with Trees.

  library(caret)
library(rattle)
inTrain <- createDataPartition(y = iris$Species,
p = 0.7,
list = FALSE)
training <- iris[inTrain,]
testing <- iris[-inTrain,]
modFit <- train(Species ~ .,method = "rpart",data = training)
fancyRpartPlot(modFit$finalModel)

Sample Image

Problem installing RGtk2 in Arch Linux (Manjaro)

I've stumbled upon the same issue on Fedora. The RGtk2 package is apparently using some Pango structures that shouldn't be using in the first place. Since v1.44, these structures are explicitly private, and thus the compilation error.

I've notified both the Pango and RGtk2 maintainers. For now, the only workaround is to downgrade Pango to v1.43.

Error installing rattle package in Mac

Well, since nothing worked, I uninstalled RStudio completely and also uninstalled R( also from Homebrew).

Then reinstalled everything again.

Here is what I did on another machine and it worked.

  1. Install XQuartz from this link.
  2. Install GTK+ from this link.
  3. run install.packages("rattle", dependencies = T)

This will work.



Related Topics



Leave a reply



Submit