Instantly share code, notes, and snippets.

Embed
What would you like to do?
A brief note on how to install rattle/RGtk2 on macOS
@paterfamilias

This comment has been minimized.

Show comment
Hide comment
@paterfamilias

paterfamilias Sep 21, 2017

I have OS 10.11.4 running on a 2014 iMac, and R 3.4.1. This process breaks for me at step 9 with "Error: gtk+ 2.24.31 did not build"
Has something changed in the past few weeks, or am I doing something wrong?
UPDATE: It looks like I needed to reinstall Xquartz. I did that, the installation went fine (and took a lot longer), and everything seems to work now. Thanks for posting these instructions!

paterfamilias commented Sep 21, 2017

I have OS 10.11.4 running on a 2014 iMac, and R 3.4.1. This process breaks for me at step 9 with "Error: gtk+ 2.24.31 did not build"
Has something changed in the past few weeks, or am I doing something wrong?
UPDATE: It looks like I needed to reinstall Xquartz. I did that, the installation went fine (and took a lot longer), and everything seems to work now. Thanks for posting these instructions!

@suzliz

This comment has been minimized.

Show comment
Hide comment
@suzliz

suzliz Sep 30, 2017

Thanks a million - it worked!

suzliz commented Sep 30, 2017

Thanks a million - it worked!

@fallsit

This comment has been minimized.

Show comment
Hide comment
@fallsit

fallsit Oct 11, 2017

I have macOS Sierra 10.12.6, and R version R version 3.4.2. At the step14. It shows some error as below:

trying URL 'https://togaware.com/access/rattle_5.0.14.tar.gz'
Content type 'application/x-tar' length 2993321 bytes (2.9 MB)

downloaded 2.9 MB

ERROR: dependency 'RGtk2' is not available for package 'rattle'

  • removing '/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rattle'
    Warning message:
    In install.packages("https://togaware.com/access/rattle_5.0.14.tar.gz", :
    installation of package '/var/folders/hv/4yplv0596sbblcds_jj2_6k80000gn/T//RtmpRgZAKq/downloaded_packages/rattle_5.0.14.tar.gz' had non-zero exit status

Is it something wrong with my steps?

fallsit commented Oct 11, 2017

I have macOS Sierra 10.12.6, and R version R version 3.4.2. At the step14. It shows some error as below:

trying URL 'https://togaware.com/access/rattle_5.0.14.tar.gz'
Content type 'application/x-tar' length 2993321 bytes (2.9 MB)

downloaded 2.9 MB

ERROR: dependency 'RGtk2' is not available for package 'rattle'

  • removing '/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rattle'
    Warning message:
    In install.packages("https://togaware.com/access/rattle_5.0.14.tar.gz", :
    installation of package '/var/folders/hv/4yplv0596sbblcds_jj2_6k80000gn/T//RtmpRgZAKq/downloaded_packages/rattle_5.0.14.tar.gz' had non-zero exit status

Is it something wrong with my steps?

@sarahpolcz

This comment has been minimized.

Show comment
Hide comment
@sarahpolcz

sarahpolcz Oct 18, 2017

Many thanks for this. Worked for me with Sierra 10.12.6 and R version 3.4.2. Enabled me to install RQDA.

sarahpolcz commented Oct 18, 2017

Many thanks for this. Worked for me with Sierra 10.12.6 and R version 3.4.2. Enabled me to install RQDA.

@zhiyzuo

This comment has been minimized.

Show comment
Hide comment
@zhiyzuo

zhiyzuo Oct 19, 2017

@fallsit, I have not seen an error like this. Any updates now?

Owner

zhiyzuo commented Oct 19, 2017

@fallsit, I have not seen an error like this. Any updates now?

@foohm71

This comment has been minimized.

Show comment
Hide comment
@foohm71

foohm71 Oct 19, 2017

I am getting this when doing "R CMD INSTALL RGtk2_2.20.33.tar.gz"

configure: error: GTK version 2.8.0 required

I am on MacOS Sierra 10.12.6, R version is 3.4.2
When I did "brew install --build-from-source --verbose gtk+" it installed GTK 2.24.31_1

foohm71 commented Oct 19, 2017

I am getting this when doing "R CMD INSTALL RGtk2_2.20.33.tar.gz"

configure: error: GTK version 2.8.0 required

I am on MacOS Sierra 10.12.6, R version is 3.4.2
When I did "brew install --build-from-source --verbose gtk+" it installed GTK 2.24.31_1

@zhiyzuo

This comment has been minimized.

Show comment
Hide comment
@zhiyzuo

zhiyzuo Oct 20, 2017

@foohm71. Can you do a brew doctor to see if any related message comes up?

Owner

zhiyzuo commented Oct 20, 2017

@foohm71. Can you do a brew doctor to see if any related message comes up?

@foohm71

This comment has been minimized.

Show comment
Hide comment
@foohm71

foohm71 Oct 20, 2017

Not sure if these could cause issues:

Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected dylibs:
/usr/local/lib/libtcl8.6.dylib
/usr/local/lib/libtk8.6.dylib

Warning: Unbrewed .pc files were found in /usr/local/lib/pkgconfig.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected .pc files:
/usr/local/lib/pkgconfig/tcl.pc
/usr/local/lib/pkgconfig/tk.pc

Warning: Unbrewed static libraries were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected static libraries:
/usr/local/lib/libtclstub8.6.a
/usr/local/lib/libtkstub8.6.a

foohm71 commented Oct 20, 2017

Not sure if these could cause issues:

Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected dylibs:
/usr/local/lib/libtcl8.6.dylib
/usr/local/lib/libtk8.6.dylib

Warning: Unbrewed .pc files were found in /usr/local/lib/pkgconfig.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected .pc files:
/usr/local/lib/pkgconfig/tcl.pc
/usr/local/lib/pkgconfig/tk.pc

Warning: Unbrewed static libraries were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected static libraries:
/usr/local/lib/libtclstub8.6.a
/usr/local/lib/libtkstub8.6.a

@uiang

This comment has been minimized.

Show comment
Hide comment
@uiang

uiang Oct 23, 2017

I am on MacOS Sierra 10.12.6 and have R version 3.4.2.
At the step11 it shows an error as below:

R session is headless; GTK+ not initialized.
Error: package or namespace load failed for ‘RGtk2’:
.onLoad failed in loadNamespace() for 'RGtk2', details:
call: .RGtkCall("S_gtk_builder_get_type", PACKAGE = "RGtk2")
error: object has no G type

uiang commented Oct 23, 2017

I am on MacOS Sierra 10.12.6 and have R version 3.4.2.
At the step11 it shows an error as below:

R session is headless; GTK+ not initialized.
Error: package or namespace load failed for ‘RGtk2’:
.onLoad failed in loadNamespace() for 'RGtk2', details:
call: .RGtkCall("S_gtk_builder_get_type", PACKAGE = "RGtk2")
error: object has no G type

@zhiyzuo

This comment has been minimized.

Show comment
Hide comment
@zhiyzuo

zhiyzuo Nov 1, 2017

@foohm71 Can you find gtk related folder in /usr/local/Cellar ?

Owner

zhiyzuo commented Nov 1, 2017

@foohm71 Can you find gtk related folder in /usr/local/Cellar ?

@zhiyzuo

This comment has been minimized.

Show comment
Hide comment
@zhiyzuo

zhiyzuo Nov 1, 2017

@uiang what did you run to get this error?

Owner

zhiyzuo commented Nov 1, 2017

@uiang what did you run to get this error?

@zhiyzuo

This comment has been minimized.

Show comment
Hide comment
@zhiyzuo

zhiyzuo Nov 13, 2017

@foohm71, @uiang. See the my revision at step 10 to see if that helps.

Owner

zhiyzuo commented Nov 13, 2017

@foohm71, @uiang. See the my revision at step 10 to see if that helps.

@berkorbay

This comment has been minimized.

Show comment
Hide comment
@berkorbay

berkorbay Nov 15, 2017

One important point might be the removal of gtk+ with brew uninstall. Because if you already have gtk+ on your system, brew will ignore your attempt. If that's the case use;

brew uninstall gtk+ --ignore-dependencies

p.s. Amazing tutorial btw.

berkorbay commented Nov 15, 2017

One important point might be the removal of gtk+ with brew uninstall. Because if you already have gtk+ on your system, brew will ignore your attempt. If that's the case use;

brew uninstall gtk+ --ignore-dependencies

p.s. Amazing tutorial btw.

@zvada

This comment has been minimized.

Show comment
Hide comment
@zvada

zvada Nov 16, 2017

That's fantastic tutorial, I spent hours to install rattle but without finding this guide I wouldn't succeed! Thanks a lot!!! OS X El Captain (10.11.6) and R version 3.4.2 was my case, though. To uninstall gtk+ I haven't used flag --ignore-dependences.

zvada commented Nov 16, 2017

That's fantastic tutorial, I spent hours to install rattle but without finding this guide I wouldn't succeed! Thanks a lot!!! OS X El Captain (10.11.6) and R version 3.4.2 was my case, though. To uninstall gtk+ I haven't used flag --ignore-dependences.

@ningchencontact

This comment has been minimized.

Show comment
Hide comment
@ningchencontact

ningchencontact Nov 25, 2017

Thanks a million - it worked!!!! 👍

ningchencontact commented Nov 25, 2017

Thanks a million - it worked!!!! 👍

@sanromd

This comment has been minimized.

Show comment
Hide comment
@sanromd

sanromd Nov 28, 2017

Hello, great tutorial, thanks for sharing. I am having an issue at step 7 and I am unable to install cairo. The output of brew install --with-x11 cairo is below. I am running MacOs High Sierra 10.13.1 and gcc 7.2. What could be the error?

`~ brew install --with-x11 cairo
==> Downloading https://cairographics.org/releases/cairo-1.14.10.tar.xz
Already downloaded: /Users/sanromd/Library/Caches/Homebrew/cairo-1.14.10.tar.xz
==> ./configure --prefix=/usr/local/Cellar/cairo/1.14.10 --enable-gobject=yes --enable-svg=yes --enable-tee=yes --enable-quartz-image --enable-xcb=yes --enable-xlib=yes --enable-xlib-xrender=yes
Last 15 lines from /Users/username/Library/Logs/Homebrew/cairo/01.configure:
configure: WARNING: CoreGraphics/CoreGraphics.h: present but cannot be compiled
configure: WARNING: CoreGraphics/CoreGraphics.h: check for missing prerequisite headers?
configure: WARNING: CoreGraphics/CoreGraphics.h: see the Autoconf documentation
configure: WARNING: CoreGraphics/CoreGraphics.h: section "Present But Cannot Be Compiled"
configure: WARNING: CoreGraphics/CoreGraphics.h: proceeding with the compiler's result
configure: WARNING: ## ---------------------------------------------------------------------- ##
configure: WARNING: ## Report this to http://bugs.freedesktop.org/enter_bug.cgi?product=cairo ##
configure: WARNING: ## ---------------------------------------------------------------------- ##
checking for CoreGraphics/CoreGraphics.h... no
checking whether cairo's Quartz surface backend feature could be enabled... no (requires CoreGraphics framework)
checking for cairo's Quartz font backend feature...
checking whether cairo's Quartz font backend feature could be enabled... no (requires CoreGraphics framework)
checking for cairo's Quartz Image surface backend feature...
checking whether cairo's Quartz Image surface backend feature could be enabled... no (requires CoreGraphics framework)

configure: error: Quartz Image surface backend feature could not be enabled`

sanromd commented Nov 28, 2017

Hello, great tutorial, thanks for sharing. I am having an issue at step 7 and I am unable to install cairo. The output of brew install --with-x11 cairo is below. I am running MacOs High Sierra 10.13.1 and gcc 7.2. What could be the error?

`~ brew install --with-x11 cairo
==> Downloading https://cairographics.org/releases/cairo-1.14.10.tar.xz
Already downloaded: /Users/sanromd/Library/Caches/Homebrew/cairo-1.14.10.tar.xz
==> ./configure --prefix=/usr/local/Cellar/cairo/1.14.10 --enable-gobject=yes --enable-svg=yes --enable-tee=yes --enable-quartz-image --enable-xcb=yes --enable-xlib=yes --enable-xlib-xrender=yes
Last 15 lines from /Users/username/Library/Logs/Homebrew/cairo/01.configure:
configure: WARNING: CoreGraphics/CoreGraphics.h: present but cannot be compiled
configure: WARNING: CoreGraphics/CoreGraphics.h: check for missing prerequisite headers?
configure: WARNING: CoreGraphics/CoreGraphics.h: see the Autoconf documentation
configure: WARNING: CoreGraphics/CoreGraphics.h: section "Present But Cannot Be Compiled"
configure: WARNING: CoreGraphics/CoreGraphics.h: proceeding with the compiler's result
configure: WARNING: ## ---------------------------------------------------------------------- ##
configure: WARNING: ## Report this to http://bugs.freedesktop.org/enter_bug.cgi?product=cairo ##
configure: WARNING: ## ---------------------------------------------------------------------- ##
checking for CoreGraphics/CoreGraphics.h... no
checking whether cairo's Quartz surface backend feature could be enabled... no (requires CoreGraphics framework)
checking for cairo's Quartz font backend feature...
checking whether cairo's Quartz font backend feature could be enabled... no (requires CoreGraphics framework)
checking for cairo's Quartz Image surface backend feature...
checking whether cairo's Quartz Image surface backend feature could be enabled... no (requires CoreGraphics framework)

configure: error: Quartz Image surface backend feature could not be enabled`

@jingyuzheng

This comment has been minimized.

Show comment
Hide comment
@jingyuzheng

jingyuzheng Dec 5, 2017

Hello! It shows the error below when I did this ~/Downloads$ R CMD INSTALL RGtk2_2.20.33.tar.gz:
Rgtk.c:7:10: fatal error: 'gdk/gdkx.h' file not found
#include <gdk/gdkx.h>
^
1 error generated.
make: *** [Rgtk.o] Error 1
ERROR: compilation failed for package ‘RGtk2’

  • removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/RGtk2’

Any idea on how to solve this problem? Thanks in advance!! ps: very helpful tutorial! Thanks a lot!

jingyuzheng commented Dec 5, 2017

Hello! It shows the error below when I did this ~/Downloads$ R CMD INSTALL RGtk2_2.20.33.tar.gz:
Rgtk.c:7:10: fatal error: 'gdk/gdkx.h' file not found
#include <gdk/gdkx.h>
^
1 error generated.
make: *** [Rgtk.o] Error 1
ERROR: compilation failed for package ‘RGtk2’

  • removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/RGtk2’

Any idea on how to solve this problem? Thanks in advance!! ps: very helpful tutorial! Thanks a lot!

@zhiyzuo

This comment has been minimized.

Show comment
Hide comment
@zhiyzuo

zhiyzuo Dec 17, 2017

@jingyuzheng, it seems like you did not install gtk+ successfully

Owner

zhiyzuo commented Dec 17, 2017

@jingyuzheng, it seems like you did not install gtk+ successfully

@installingrattle

This comment has been minimized.

Show comment
Hide comment
@installingrattle

installingrattle Jan 3, 2018

Thank you so much for this tutorial.

Do you know why I'd be getting this error, when I attempt your Step 11? Thank you again.


Downloads $ R CMD INSTALL RGtk2_2.20.33.tar.gz
Warning in strptime(xx, f <- "%Y-%m-%d %H:%M:%OS", tz = tz) :
  unknown timezone 'zone/tz/2017c.1.0/zoneinfo/Australia/Melbourne'
* installing to library ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library’
* installing *source* package ‘RGtk2’ ...
** package ‘RGtk2’ successfully unpacked and MD5 sums checked
checking for pkg-config... /usr/local/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for INTROSPECTION... no
checking for GTK... no
configure: error: GTK version 2.8.0 required
ERROR: configuration failed for package ‘RGtk2’
* removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/RGtk2’
pc053301:Downloads $ 

installingrattle commented Jan 3, 2018

Thank you so much for this tutorial.

Do you know why I'd be getting this error, when I attempt your Step 11? Thank you again.


Downloads $ R CMD INSTALL RGtk2_2.20.33.tar.gz
Warning in strptime(xx, f <- "%Y-%m-%d %H:%M:%OS", tz = tz) :
  unknown timezone 'zone/tz/2017c.1.0/zoneinfo/Australia/Melbourne'
* installing to library ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library’
* installing *source* package ‘RGtk2’ ...
** package ‘RGtk2’ successfully unpacked and MD5 sums checked
checking for pkg-config... /usr/local/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for INTROSPECTION... no
checking for GTK... no
configure: error: GTK version 2.8.0 required
ERROR: configuration failed for package ‘RGtk2’
* removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/RGtk2’
pc053301:Downloads $ 
@installingrattle

This comment has been minimized.

Show comment
Hide comment
@installingrattle

installingrattle commented Jan 3, 2018

Thank you, I used your tips as well as
http://marcoghislanzoni.com/blog/2014/08/29/solved-installing-rattle-r-3-1-mac-os-x-10-9/
and it runs now!
Thanks again

@rsalek

This comment has been minimized.

Show comment
Hide comment
@rsalek

rsalek Jan 15, 2018

Great help thx @zhiyzuo
Also @jingyuzheng re:
Rgtk.c:7:10: fatal error: 'gdk/gdkx.h' file not found
#include <gdk/gdkx.h>
^
1 error generated.
make: *** [Rgtk.o] Error 1
ERROR: compilation failed for package ‘RGtk2’
removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/RGtk2’

brew uninstall gtk+ --ignore-dependencies
and then install again fixed mine

rsalek commented Jan 15, 2018

Great help thx @zhiyzuo
Also @jingyuzheng re:
Rgtk.c:7:10: fatal error: 'gdk/gdkx.h' file not found
#include <gdk/gdkx.h>
^
1 error generated.
make: *** [Rgtk.o] Error 1
ERROR: compilation failed for package ‘RGtk2’
removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/RGtk2’

brew uninstall gtk+ --ignore-dependencies
and then install again fixed mine

@Boggartfly

This comment has been minimized.

Show comment
Hide comment
@Boggartfly

Boggartfly Jan 19, 2018

Thanks for the tutorial, this works for me.

Boggartfly commented Jan 19, 2018

Thanks for the tutorial, this works for me.

@lizpund

This comment has been minimized.

Show comment
Hide comment
@lizpund

lizpund Jan 21, 2018

Thank you so, so much for this tutorial. It made all the difference in being able to move forward on this issue. I am almost there. I was able to get all the way through the end and Rattle did open from XQuartz.

However, I tried to then open Rattle from R Studio and I'm getting stuck on a similar error as @uiang. I am wondering if anyone figured out how to get around it. I am running the following:

  • Mac OS 10.13.2 (High Sierra)
  • R 3.4.3 GUI 1.70 El Capitan build (7463)
  • XQuartz 2.7.11 (xorg-server 1.18.4)
  • RStudio Version 1.1.414

So when I use the XQuartz Terminal, I type library(rattle) and then rattle(), and Rattle opens.

> library(rattle)
Rattle: A free graphical interface for data mining with R.
Version 5.0.14 Copyright (c) 2006-2017 Togaware Pty Ltd.
Type 'rattle()' to shake, rattle, and roll your data.
> rattle ()

(Rattle opens)

But when I use the R Terminal, I try the same thing and this is what I get

> library(rattle)
R session is headless; GTK+ not initialized.
Rattle: A free graphical interface for data mining with R.
Version 5.0.14 Copyright (c) 2006-2017 Togaware Pty Ltd.
Type 'rattle()' to shake, rattle, and roll your data.
> rattle()
Error in rattle() : Can't load RGtk2.
  A windowing system can't be accessed?
  Maybe you are using a remote terminal (ssh) or RStudio browser connection.
  Consider using remote desktop, ssh -X, or X2Go depending on your platform.
  Running rattle() locally on a desktop is the default.
(R:66236): Gtk-WARNING **: gtk_disable_setlocale() must be called before gtk_init()

And when I use R Studio, I try the same thing and this is what I get:

> library(rattle)
R session is headless; GTK+ not initialized.
Rattle: A free graphical interface for data mining with R.
Version 5.0.14 Copyright (c) 2006-2017 Togaware Pty Ltd.
Type 'rattle()' to shake, rattle, and roll your data.
> rattle()
(R:66390): Gtk-WARNING **: gtk_disable_setlocale() must be called before gtk_init()
Error in rattle() : Can't load RGtk2.
  A windowing system can't be accessed?
  Maybe you are using a remote terminal (ssh) or RStudio browser connection.
  Consider using remote desktop, ssh -X, or X2Go depending on your platform.
  Running rattle() locally on a desktop is the default.

I tried reinstalling RGtk2 in the Terminal and noticed I am getting this at the end of the install:

...
** R
** demo
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
R session is headless; GTK+ not initialized.
* DONE (RGtk2)

Thanks in advance for any advice.

lizpund commented Jan 21, 2018

Thank you so, so much for this tutorial. It made all the difference in being able to move forward on this issue. I am almost there. I was able to get all the way through the end and Rattle did open from XQuartz.

However, I tried to then open Rattle from R Studio and I'm getting stuck on a similar error as @uiang. I am wondering if anyone figured out how to get around it. I am running the following:

  • Mac OS 10.13.2 (High Sierra)
  • R 3.4.3 GUI 1.70 El Capitan build (7463)
  • XQuartz 2.7.11 (xorg-server 1.18.4)
  • RStudio Version 1.1.414

So when I use the XQuartz Terminal, I type library(rattle) and then rattle(), and Rattle opens.

> library(rattle)
Rattle: A free graphical interface for data mining with R.
Version 5.0.14 Copyright (c) 2006-2017 Togaware Pty Ltd.
Type 'rattle()' to shake, rattle, and roll your data.
> rattle ()

(Rattle opens)

But when I use the R Terminal, I try the same thing and this is what I get

> library(rattle)
R session is headless; GTK+ not initialized.
Rattle: A free graphical interface for data mining with R.
Version 5.0.14 Copyright (c) 2006-2017 Togaware Pty Ltd.
Type 'rattle()' to shake, rattle, and roll your data.
> rattle()
Error in rattle() : Can't load RGtk2.
  A windowing system can't be accessed?
  Maybe you are using a remote terminal (ssh) or RStudio browser connection.
  Consider using remote desktop, ssh -X, or X2Go depending on your platform.
  Running rattle() locally on a desktop is the default.
(R:66236): Gtk-WARNING **: gtk_disable_setlocale() must be called before gtk_init()

And when I use R Studio, I try the same thing and this is what I get:

> library(rattle)
R session is headless; GTK+ not initialized.
Rattle: A free graphical interface for data mining with R.
Version 5.0.14 Copyright (c) 2006-2017 Togaware Pty Ltd.
Type 'rattle()' to shake, rattle, and roll your data.
> rattle()
(R:66390): Gtk-WARNING **: gtk_disable_setlocale() must be called before gtk_init()
Error in rattle() : Can't load RGtk2.
  A windowing system can't be accessed?
  Maybe you are using a remote terminal (ssh) or RStudio browser connection.
  Consider using remote desktop, ssh -X, or X2Go depending on your platform.
  Running rattle() locally on a desktop is the default.

I tried reinstalling RGtk2 in the Terminal and noticed I am getting this at the end of the install:

...
** R
** demo
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
R session is headless; GTK+ not initialized.
* DONE (RGtk2)

Thanks in advance for any advice.

@zhiyzuo

This comment has been minimized.

Show comment
Hide comment
@zhiyzuo

zhiyzuo Jan 21, 2018

@mindexplore.
Can you try first open XQuartz then run rattle in RStudio?

Owner

zhiyzuo commented Jan 21, 2018

@mindexplore.
Can you try first open XQuartz then run rattle in RStudio?

@lizpund

This comment has been minimized.

Show comment
Hide comment
@lizpund

lizpund Jan 22, 2018

@zhiyzuo I'll try it! I appreciate your reply.

OK, just tried it by closing everything and then, did the following in this order:
a) opened XQuartz
b) opened RStudio
c) in RStudio, I ran library(rattle)
d) in RStudio, I ran ran rattle()

Unfortunately, I got the same output:

> library(rattle)
R session is headless; GTK+ not initialized.
Rattle: A free graphical interface for data mining with R.
Version 5.0.14 Copyright (c) 2006-2017 Togaware Pty Ltd.
Type 'rattle()' to shake, rattle, and roll your data.
> rattle()

(R:67092): Gtk-WARNING **: gtk_disable_setlocale() must be called before gtk_init()
Error in rattle() : Can't load RGtk2.
  A windowing system can't be accessed?
  Maybe you are using a remote terminal (ssh) or RStudio browser connection.
  Consider using remote desktop, ssh -X, or X2Go depending on your platform.
  Running rattle() locally on a desktop is the default.

lizpund commented Jan 22, 2018

@zhiyzuo I'll try it! I appreciate your reply.

OK, just tried it by closing everything and then, did the following in this order:
a) opened XQuartz
b) opened RStudio
c) in RStudio, I ran library(rattle)
d) in RStudio, I ran ran rattle()

Unfortunately, I got the same output:

> library(rattle)
R session is headless; GTK+ not initialized.
Rattle: A free graphical interface for data mining with R.
Version 5.0.14 Copyright (c) 2006-2017 Togaware Pty Ltd.
Type 'rattle()' to shake, rattle, and roll your data.
> rattle()

(R:67092): Gtk-WARNING **: gtk_disable_setlocale() must be called before gtk_init()
Error in rattle() : Can't load RGtk2.
  A windowing system can't be accessed?
  Maybe you are using a remote terminal (ssh) or RStudio browser connection.
  Consider using remote desktop, ssh -X, or X2Go depending on your platform.
  Running rattle() locally on a desktop is the default.
@zhiyzuo

This comment has been minimized.

Show comment
Hide comment
@zhiyzuo

zhiyzuo Jan 23, 2018

@mindexplore How about loading the package RGtk2 in XQuartz and then tried to open rattle in RStudio?

I remembered that the way I tested was similar to make rattle run in RStudio but did not remember clearly. Basically I tried to get GTK work since RStudio somehow was unable to do this.

Owner

zhiyzuo commented Jan 23, 2018

@mindexplore How about loading the package RGtk2 in XQuartz and then tried to open rattle in RStudio?

I remembered that the way I tested was similar to make rattle run in RStudio but did not remember clearly. Basically I tried to get GTK work since RStudio somehow was unable to do this.

@JennySong29

This comment has been minimized.

Show comment
Hide comment
@JennySong29

JennySong29 Jan 24, 2018

I met a problem similar to mindexplore. In the step 15, when I type "library (cattle)" It showed
" R session is headless; GTK+ not initialized.
Rattle: A free graphical interface for data mining with R.
Version 5.0.14 Copyright (c) 2006-2017 Togaware Pty Ltd.
Type 'rattle()' to shake, rattle, and roll your data."
then, I type "rattle()", it showed
"Error in rattle() : Can't load RGtk2.
A windowing system can't be accessed?
Maybe you are using a remote terminal (ssh) or RStudio browser connection.
Consider using remote desktop, ssh -X, or X2Go depending on your platform.
Running rattle() locally on a desktop is the default.

(R:88432): Gtk-WARNING **: gtk_disable_setlocale() must be called before gtk_init()"

I don't know how to solve this problem.

JennySong29 commented Jan 24, 2018

I met a problem similar to mindexplore. In the step 15, when I type "library (cattle)" It showed
" R session is headless; GTK+ not initialized.
Rattle: A free graphical interface for data mining with R.
Version 5.0.14 Copyright (c) 2006-2017 Togaware Pty Ltd.
Type 'rattle()' to shake, rattle, and roll your data."
then, I type "rattle()", it showed
"Error in rattle() : Can't load RGtk2.
A windowing system can't be accessed?
Maybe you are using a remote terminal (ssh) or RStudio browser connection.
Consider using remote desktop, ssh -X, or X2Go depending on your platform.
Running rattle() locally on a desktop is the default.

(R:88432): Gtk-WARNING **: gtk_disable_setlocale() must be called before gtk_init()"

I don't know how to solve this problem.

@bsou

This comment has been minimized.

Show comment
Hide comment
@bsou

bsou Jan 30, 2018

@uiang Did you get a solution to your problem?

Seems like I have run into a similar problem.

I'm using Mac OS High Sierra 10.13.2 and have R 3.4.1.

I run into the following issue, after trying to install RGtk2 using the following command

$ R CMD INSTALL ~/Downloads/RGtk2_2.20.34.tar.gz
........

installing to /Library/Frameworks/R.framework/Versions/3.4/Resources/library/RGtk2/libs
** R
** demo
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded

Error: package or namespace load failed for ‘RGtk2’:
.onLoad failed in loadNamespace() for 'RGtk2', details:
call: .RGtkCall("S_gtk_builder_get_type", PACKAGE = "RGtk2")
error: object has no G type
Error: loading failed
Execution halted
ERROR: loading failed

removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/RGtk2’


Any pointers on this would be helpful.

bsou commented Jan 30, 2018

@uiang Did you get a solution to your problem?

Seems like I have run into a similar problem.

I'm using Mac OS High Sierra 10.13.2 and have R 3.4.1.

I run into the following issue, after trying to install RGtk2 using the following command

$ R CMD INSTALL ~/Downloads/RGtk2_2.20.34.tar.gz
........

installing to /Library/Frameworks/R.framework/Versions/3.4/Resources/library/RGtk2/libs
** R
** demo
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded

Error: package or namespace load failed for ‘RGtk2’:
.onLoad failed in loadNamespace() for 'RGtk2', details:
call: .RGtkCall("S_gtk_builder_get_type", PACKAGE = "RGtk2")
error: object has no G type
Error: loading failed
Execution halted
ERROR: loading failed

removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/RGtk2’


Any pointers on this would be helpful.

@lizpund

This comment has been minimized.

Show comment
Hide comment
@lizpund

lizpund Feb 1, 2018

@zhiyzuo That seems to have done the trick! Thank you so much.

lizpund commented Feb 1, 2018

@zhiyzuo That seems to have done the trick! Thank you so much.

@mschmidty

This comment has been minimized.

Show comment
Hide comment
@mschmidty

mschmidty Feb 8, 2018

Thanks for your tutorial. I really appreciate it. I am having the same problem when I try to load RGtk2 from the ~/Downloads folder. Some things I have tried:I checked and I do have gtk+ in my local/cellar folder. I also checked my .bash_profile and it looks like the path is in there. I also tried to load the source file from Xquartz with no luck. I'm not really sure what to do. Here's my error just in case:

* installing to library ‘/Users/mikes/Library/R/3.4/library’
* installing *source* package ‘RGtk2’ ...
** package ‘RGtk2’ successfully unpacked and MD5 sums checked
checking for pkg-config... /usr/local/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for INTROSPECTION... no
checking for GTK... no
configure: error: GTK version 2.8.0 required
ERROR: configuration failed for package ‘RGtk2’
* removing ‘/Users/mikes/Library/R/3.4/library/RGtk2’

Can you elaborate @mindexplore about how you loaded the package in XQuarts. I tried and it still didn't work.

mschmidty commented Feb 8, 2018

Thanks for your tutorial. I really appreciate it. I am having the same problem when I try to load RGtk2 from the ~/Downloads folder. Some things I have tried:I checked and I do have gtk+ in my local/cellar folder. I also checked my .bash_profile and it looks like the path is in there. I also tried to load the source file from Xquartz with no luck. I'm not really sure what to do. Here's my error just in case:

* installing to library ‘/Users/mikes/Library/R/3.4/library’
* installing *source* package ‘RGtk2’ ...
** package ‘RGtk2’ successfully unpacked and MD5 sums checked
checking for pkg-config... /usr/local/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for INTROSPECTION... no
checking for GTK... no
configure: error: GTK version 2.8.0 required
ERROR: configuration failed for package ‘RGtk2’
* removing ‘/Users/mikes/Library/R/3.4/library/RGtk2’

Can you elaborate @mindexplore about how you loaded the package in XQuarts. I tried and it still didn't work.

@Yupla

This comment has been minimized.

Show comment
Hide comment
@Yupla

Yupla Mar 7, 2018

First of all thank you very much for this tutorial. I'm struggling on the launch of rattle just by itself. here is the result I get when I try tu use rattle in rstudio :

library(rattle)
R session is headless; GTK+ not initialized.
Rattle: A free graphical interface for data mining with R.
Version 5.0.14 Copyright (c) 2006-2017 Togaware Pty Ltd.
Type 'rattle()' to shake, rattle, and roll your data.
rattle()

(R:88491): Gtk-WARNING **: gtk_disable_setlocale() must be called before gtk_init()
Error in rattle() : Can't load RGtk2.
A windowing system can't be accessed?
Maybe you are using a remote terminal (ssh) or RStudio browser connection.
Consider using remote desktop, ssh -X, or X2Go depending on your platform.
Running rattle() locally on a desktop is the default.

Like you told another user here I tried to first load RGtk2 in the xquartz terminal but it does't seem to work. Do you have any idea on this ?

Yupla commented Mar 7, 2018

First of all thank you very much for this tutorial. I'm struggling on the launch of rattle just by itself. here is the result I get when I try tu use rattle in rstudio :

library(rattle)
R session is headless; GTK+ not initialized.
Rattle: A free graphical interface for data mining with R.
Version 5.0.14 Copyright (c) 2006-2017 Togaware Pty Ltd.
Type 'rattle()' to shake, rattle, and roll your data.
rattle()

(R:88491): Gtk-WARNING **: gtk_disable_setlocale() must be called before gtk_init()
Error in rattle() : Can't load RGtk2.
A windowing system can't be accessed?
Maybe you are using a remote terminal (ssh) or RStudio browser connection.
Consider using remote desktop, ssh -X, or X2Go depending on your platform.
Running rattle() locally on a desktop is the default.

Like you told another user here I tried to first load RGtk2 in the xquartz terminal but it does't seem to work. Do you have any idea on this ?

@cratzdo

This comment has been minimized.

Show comment
Hide comment
@cratzdo

cratzdo May 9, 2018

@zhiyzuo, thanks for you efforts in presenting this tutorial. At Step 7, when applying brew install --with-x11 cairo, brew gave "Warning: cairo: this formula has no --with-x11 option so it will be ignored!", how do you enable the --with-x11 option at this step? Thanks!

cratzdo commented May 9, 2018

@zhiyzuo, thanks for you efforts in presenting this tutorial. At Step 7, when applying brew install --with-x11 cairo, brew gave "Warning: cairo: this formula has no --with-x11 option so it will be ignored!", how do you enable the --with-x11 option at this step? Thanks!

@milti
@jamesmnw

This comment has been minimized.

Show comment
Hide comment
@jamesmnw

jamesmnw May 18, 2018

@cratzdo The most recent commit to cairo.rb removed the --with-x11 option. I used brew edit cairo to replace the Formula with the one at: https://github.com/Homebrew/homebrew-core/blob/1fea60405bf98c6385dfba18c75a7fb667dc3a40/Formula/cairo.rb.

jamesmnw commented May 18, 2018

@cratzdo The most recent commit to cairo.rb removed the --with-x11 option. I used brew edit cairo to replace the Formula with the one at: https://github.com/Homebrew/homebrew-core/blob/1fea60405bf98c6385dfba18c75a7fb667dc3a40/Formula/cairo.rb.

@chicofish

This comment has been minimized.

Show comment
Hide comment
@chicofish

chicofish May 22, 2018

@jamesmnw for(i in 1:1000000){print("THANKS")} That hidden error in the cairo build of ignoring the -x11 flag caused me days of grief. Thanks for pointing that out. Your edit worked perfectly, allowing the rest of the instructions to work. I can now Rattle and RQDA and the world is a better place. :-)

chicofish commented May 22, 2018

@jamesmnw for(i in 1:1000000){print("THANKS")} That hidden error in the cairo build of ignoring the -x11 flag caused me days of grief. Thanks for pointing that out. Your edit worked perfectly, allowing the rest of the instructions to work. I can now Rattle and RQDA and the world is a better place. :-)

@vincent-yung

This comment has been minimized.

Show comment
Hide comment
@vincent-yung

vincent-yung May 23, 2018

@milti, follow @jamesmnw's advice and make sure to brew reinstall --with-x11 cairo after editing the cairo formula.

vincent-yung commented May 23, 2018

@milti, follow @jamesmnw's advice and make sure to brew reinstall --with-x11 cairo after editing the cairo formula.

@ScarlettU

This comment has been minimized.

Show comment
Hide comment
@ScarlettU

ScarlettU May 27, 2018

Thanks for your detailed advice. But it is still frustrating for me.
After typing "brew install --build-from-source --verbose gtk+" , I received "Error: gtk+ 2.24.32 did not build"
Please help me out. It's too hard for me.

ScarlettU commented May 27, 2018

Thanks for your detailed advice. But it is still frustrating for me.
After typing "brew install --build-from-source --verbose gtk+" , I received "Error: gtk+ 2.24.32 did not build"
Please help me out. It's too hard for me.

@wabee

This comment has been minimized.

Show comment
Hide comment
@wabee

wabee May 29, 2018

The key to success for me was to use @jamesmnw advice and edit the configuration file for cairo using the formula supplied in his post and build. After that gtk+ build without errors. I could then just follow the instructions to install RGtk2 and cairodevice + rattle. To bad they messed up Homebrews version of cairo and caused all these problems

wabee commented May 29, 2018

The key to success for me was to use @jamesmnw advice and edit the configuration file for cairo using the formula supplied in his post and build. After that gtk+ build without errors. I could then just follow the instructions to install RGtk2 and cairodevice + rattle. To bad they messed up Homebrews version of cairo and caused all these problems

@hughng92

This comment has been minimized.

Show comment
Hide comment
@hughng92

hughng92 Jun 4, 2018

Hello,
I need help. I am at step 8 with "brew edit gtk+"
When I am done editing the last two lines in df install, I do not know how to save or quit in the terminal.
I did run export EDITOR = vim.
I hope I provided info for troubleshooting.
Thanks a lot.

hughng92 commented Jun 4, 2018

Hello,
I need help. I am at step 8 with "brew edit gtk+"
When I am done editing the last two lines in df install, I do not know how to save or quit in the terminal.
I did run export EDITOR = vim.
I hope I provided info for troubleshooting.
Thanks a lot.

@aniket-cybrilla

This comment has been minimized.

Show comment
Hide comment
@aniket-cybrilla

aniket-cybrilla Jun 12, 2018

What is the solution to the below?

~/Downloads -> R CMD INSTALL RGtk2_2.20.34.tar.gz
During startup - Warning messages:
1: Setting LC_TIME failed, using "C"
2: Setting LC_MESSAGES failed, using "C"
3: Setting LC_MONETARY failed, using "C"
* installing to library ‘/usr/local/lib/R/3.5/site-library’
* installing *source* package ‘RGtk2’ ...
** package ‘RGtk2’ successfully unpacked and MD5 sums checked
checking for pkg-config... /usr/local/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for INTROSPECTION... no
checking for GTK... no
configure: error: GTK version 2.8.0 required
ERROR: configuration failed for package ‘RGtk2’
* removing ‘/usr/local/lib/R/3.5/site-library/RGtk2’

As directed the version of GTK I manage to install is 2.24.32_2. But for RGtk2 it needs 2.8.0? Could you elaborate on the exact steps to perform to achieve this please?

aniket-cybrilla commented Jun 12, 2018

What is the solution to the below?

~/Downloads -> R CMD INSTALL RGtk2_2.20.34.tar.gz
During startup - Warning messages:
1: Setting LC_TIME failed, using "C"
2: Setting LC_MESSAGES failed, using "C"
3: Setting LC_MONETARY failed, using "C"
* installing to library ‘/usr/local/lib/R/3.5/site-library’
* installing *source* package ‘RGtk2’ ...
** package ‘RGtk2’ successfully unpacked and MD5 sums checked
checking for pkg-config... /usr/local/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for INTROSPECTION... no
checking for GTK... no
configure: error: GTK version 2.8.0 required
ERROR: configuration failed for package ‘RGtk2’
* removing ‘/usr/local/lib/R/3.5/site-library/RGtk2’

As directed the version of GTK I manage to install is 2.24.32_2. But for RGtk2 it needs 2.8.0? Could you elaborate on the exact steps to perform to achieve this please?

@yihui

This comment has been minimized.

Show comment
Hide comment
@yihui

yihui Jun 14, 2018

As I just pointed out in a comment under @zhiyzuo's post (https://zhiyzuo.github.io/installation-rattle/#comment-3944233914), the whole thing can be simplified to this:

system('brew install gtk+')

local({
  if (Sys.info()[['sysname']] != 'Darwin') return()

  .Platform$pkgType = 'mac.binary.el-capitan'
  unlockBinding('.Platform', baseenv())
  assign('.Platform', .Platform, 'package:base')
  lockBinding('.Platform', baseenv())

  options(
    pkgType = 'both', install.packages.compile.from.source = 'always',
    repos = 'https://macos.rbind.org'
  )
})

install.packages(c('RGtk2', 'cairoDevice', 'rattle'))

No more struggling with editing the gtk+ formula :)

yihui commented Jun 14, 2018

As I just pointed out in a comment under @zhiyzuo's post (https://zhiyzuo.github.io/installation-rattle/#comment-3944233914), the whole thing can be simplified to this:

system('brew install gtk+')

local({
  if (Sys.info()[['sysname']] != 'Darwin') return()

  .Platform$pkgType = 'mac.binary.el-capitan'
  unlockBinding('.Platform', baseenv())
  assign('.Platform', .Platform, 'package:base')
  lockBinding('.Platform', baseenv())

  options(
    pkgType = 'both', install.packages.compile.from.source = 'always',
    repos = 'https://macos.rbind.org'
  )
})

install.packages(c('RGtk2', 'cairoDevice', 'rattle'))

No more struggling with editing the gtk+ formula :)

@bison31205

This comment has been minimized.

Show comment
Hide comment
@bison31205

bison31205 Jul 23, 2018

thx,it work!

bison31205 commented Jul 23, 2018

thx,it work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment