Re: Building Error And Solution Regarding The X11 Path

2020. 3. 22. 19:38카테고리 없음

Total: 5 Average: 4.8/5 Rattle is a really nice GUI environment for data mining based on R. If you don’t know it yet, it is worth taking a look. Or since you are reading this, maybe you are already a user but are facing some problems to install it with the latest versions of R on your Mac using OS X 10.9.

If this is the case, you came to the right place and here is how to solve it. Explanation (jump below for the step-by-step solution) The problem with installing Rattle is linked to its dependency on the the RGtk2 package. This package will miserably fail to install under R 3.1 on Mac OS X 10.9 with a misleading set of messages like those shown below, even if installed from “source”. install.packages('RGtk2', type = 'source') trying URL 'Content type 'application/x-gzip' length 2785274 bytes (2.7 Mb) opened URL downloaded 2.7 Mb. installing.source. package ‘RGtk2’.

package ‘RGtk2’ successfully unpacked and MD5 sums checked checking for pkg-config. No 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.1/Resources/library/RGtk2’. restoring previous ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RGtk2’.

restoring previous ‘ / Library / Frameworks / R. Framework / Versions / 3.1 / Resources / library / RGtk2’ After some investigation and debugging, it turns out this is due to multiple problems that need to be solved one by one. The particularly misleading part is the dependency of the installer from pkg-config.

This can be easily solved by installing the pkg-config utility. Once pkg-config is available, the RGtk2 installer requires the presence of the gtk+-2.0.pc file (see the configuration shell script). This file was normally part of a gtk+ installation, but this is no longer the case, at least using the available Gtk+ binary installers for Mac. This can be solved by installing Gtk+ from source with the help of homebrew or port. If you are of the curious kind, here is the content of my gtk+-2.0.pc file. / opt / local / lib / pkconfig Once pkg-config knows where to find pkg+2.0.pc file, everything works fine.

By the way, a successful installation of RGtk2 can be accomplished also directly in RStudio by setting the environment variables properly. Jump to step 8) if you already did all the previous steps and just need to complete this one within RStudio. Many of the steps below are similar to those mentioned. The solutions proposed elsewhere didn’t fully work for me because they were missing the point that pkg-config cannot find the gtk+2.0.pc file. Without further due, here is the complete procedure. Step-by-step solution (1) Check under Applications – Utilities – X11 if you have X11 installed. Normally it is not installed on this version of Mac OS X. Once you check, you will be asked whether you want to install XQuartz.

Go ahead and do so. Now you should see XQuartz in your Utilities. (2) Install the latest version of port, which will help with the rest of the steps. You can get it here: (3) Install the XCode command line tools from Apple or a complete version of XCode.

You will need a (free) developer AppleID. These are necessary to build Gtk+ from source (see below). (4) Open a terminal window and issue the following commands ( is the command prompt, don’t type it!). R CMD INSTALL / Downloads / cairoDevicexx.yy.z.tar.gz where xx.yy.z are the respective version numbers of the RGtk2 and cairoDevice packages you downloaded. (7) You are done! Provided that pkgconfig can be found (see the PATH above) and that the gtk+2.0.pc file can be located (see PKGCONFIGPATH above) RGtk2 should install properly (with just some warnings). At this point you can install and launch rattle without any problems.

Now if you are using RStudio and want to install RGtk2 from source directly in it, after step 4) above do the following: (8) In RStudio, we first need to set the environment variables in a similar way we did above. This is because RStudio uses an own version of the environment when issuing system commands during a package install. Type the following in the R console ( is the command prompt, don’t type it!). DONE ( RGtk2 ) Now you can happily run rattle on your R 3.1 and Max OS X 10.9! Happy data analysis. If this solution works for you too, please let me know by leaving a comment below.

Till next time, Marco. Note (9 Dec 2014): The original article had an imprecision on the name of the environment variable pointing to the location of the gtk+2.0.pc file. The correct name is PKGCONFIGPATH and it has been corrected in the text above. Many thanks to John Honan and Alan Chao for having pointed the mistake out to me and apologies to all the readers who still encountered issues due to that imprecision. Hi Barry, we need to do a bit of trouble-shooting here.

Re: Building Error And Solution Regarding The X11 Pathfinder

First things first. Did you install pkgconfig and add its /bin folder to the PATH with this command (please note that your pkg-config binary could actually be in a different location, then you have to find out where it is and use the right path to it): export PATH=/opt/pkgconfig/bin:$PATH Please confirm it by opening a terminal and typing pkg-config with no arguments. If it works, you should see a message like: Must specify package names on the command line If it doesn’t work you should get an error. Thanks for the solution, it worked fine in Mavericks and R 3.1.1, just follow all indications step by step!!!

I have been 1 year without being capable of installing this tool in my mac (previously I had snow leopard), but now it finally works. I just want to comment that the rattle authors should have come up with a much easier way to install such tool in mac, it does not make sense to: 1) have to search the web for a solution 2) have to follow all these steps, some require time and restarts Regards, Paulo Cortez. Hi marco – i was away from sometime but I still have not been able to get it to work. Without copying and pasting your code above, I was unable to even download rgtk2. After using your code i posted a picture of the ending installation message. I can now actually get rattle to do something and at least maybe make some progress without an immediate error message. The popup box asking me to install is shown in the picture above is what I see.

If I run install.packages(“RGtk2″, type = “source”) without going through the entire process listed above, then I receive an error when attempting to download, and I am forced to recopy and paste your code from the start. Marco: I’ve tried to follow your instructions closely but something is not working.

Terminal shows: Neils-iMac: neiljones$ export PATH=/opt/local/bin:/opt/local/sbin:$PATH Neils-iMac: neiljones$ sudo port install pkgconfig — Computing dependencies for pkgconfig — Cleaning pkgconfig — Scanning binaries for linking errors — No broken files found. Neils-iMac: neiljones$ export PATH=/opt/pkgconfig/bin:$PATH Neils-iMac: neiljones$ sudo port install gtk2 +x11 — Computing dependencies for gtk2 — Cleaning gtk2 — Scanning binaries for linking errors — No broken files found. Neils-iMac: neiljones$ export PATHPKGCONFIG=/opt/local/lib/pkgconfig but R shows: Sys.getenv(“PATH”) #path not updated, 1 “/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/opt/local/bin”. The two packages appear to be installed correctly. Setting the path parameter in R does update the path, so that “library(RGtk2)” succeeds, but neither approach to package installation – via terminal or in R – works. Rattle still crashes R.

To say I’d be grateful for your help would be an understatement! Hi Neil, did you try to do steps (5), (6) and (7) as an alternative to (8) and (9)? Not sure why the latter doesn’t work, but try from the terminal directly with (5), (6) and (7), it may be easier to spot errors. The fact that the PATH you set from the terminal does not appear in R is normal because R uses an own copy of the environment. The correct way to set the path in R is to use the sys.setenv as shown in (8) and (9). Let me know whether you made it work or if you still have issues. It should function properly on your iMac as well, provided it is the same OS X and R version as your Mac Book Air.

Cheers, Marco. Very clear instructions. A couple of points. Check your usage of ‘PKGCONFIGPATH’ above, in line 6 of the step-by-step you’re calling it ‘PATHPKGCONFIG’ which I think is incorrect.

I used homebrew to install GTK instead of port, in which case the path to the pkg-config pc file location is; Sys.setenv(PKGCONFIGPATH=”/usr/X11/lib/pkgconfig”) – Which is weird because the gtk pc file is located somewhere else. There are a bunch of other pc files in that location which get picked up. Anyway, it worked for me. Hi John, glad it worked for you too. Regarding step (8), you are perfectly right. There was a typo on the name of the path variable. I corrected it in the original post, thanks for pointing this out.

Usually a copy/paste all my code from the console to make sure it is correct, but obviously I didn’t do that for that little snippet and see what happened Thanks again for catching the mistake! I didn’t try the procedure with Homebrew since Port did the job, good to know it works with it too provided that PKGCONFIGPATH is set to the proper (different) location. I used homebrew to install GTK instead of port. I am working with rattle. But I also want to try some graphs using rggobi. Hi Marco, Thanks for the step by step instructions. It works fine, but you should let everyone know that the environment variable needs to be PKGCONFIGPATH (as in your comments on 18 Oct 2014) instead of PATHPKGCONFIG as you have in your instructions.

I believe that may be the reason why some people are having problems. BTW, in case anyone cares, one does not need to install gtk+ using brew, port, or whatever. The prebuilt package GTK2.24.17-X11.pkg at works fine. It installs as a framework in /Library/Frameworks and the gtk+-2.0.pc file is in the /Library/Frameworks/GTK+.framework/Versions/2.24.X11/Resources/lib/pkgconfig/ directory, which should be the PKGCONFIGPATH. One would still need pkg-config, but that can be downloaded from and built (just configure, make, make install), which installs by default in /usr/local/bin (add that to the PATH as per your instructions). Pkg-confg –print-errors modulename found further errors Hi Marco, Excellent post. It gives enough details for further troubleshooting if required.

And in my case, it was required. After following the above instructions, I still got the dreaded 2.8.0 error message. I kept the faith, figuring pkg-config was still the problem. A quick search of 'pkg-config -help' showed the –print-errors option so I tried 'pkg-config -print-errors gtk+-2.0' and it gave me the following message: Package 'xcb-shm', required by 'cairo', not found. I then did a 'find / -name xcb-shm.pc' which found /opt/X11/lib/pkgconfig/xcb-shm.pc. I added that directory to the pk-config path with 'PKGCONFIGPATH=/usr/local/lib/pkgconfig/:/opt/X11/lib/pkgconfig' and then both 'R CMD INSTALL RGtk22.20.31.tar' and 'R CMD INSTALL cairoDevice2.20.tar' ran without a hitch. In RStudio, I ran 'install.packages('rattle')'; 'library(rattle)'; then 'rattle' and up popped the rattle window asking to install the XML package which I did and all now works as it should.

Re: Building Error And Solution Regarding The X11 Pathways

Again, excellent post. Thank you for sharing the details. It made all the difference. Pkg-config –print-errors libname finds more errors Hi Marco, Thanks for the detailed post. I followed the instructions, first using R CMD INSTALL on the command line after setting PKGCONFIGPATH to /usr/local/bin (I used homebrew to install gtk+; it was version 2.24.25), then install.packages in RStudio and still got the dreaded 2.8.0 error message both times. I kept the faith and figured I still had a problem with the package configuration.

I checked and pkg-config includes the option –list-errors. I entered pkg-config -list-errors gtk+-2.0 from which I got the error Package xcb-shm was not found in the pkg-config search path. I did a find / -name xcb-shm -print and found it in directory /opt/X11/lib/pkgconfig/ which I added to PKGCONFIGPATH. I was then able to install RGtk2, cairo and rattle with no problems.

Solution

Very gratifying. Again, thanks for the details in the post. Without them, I wouldn’t have had a clue.

My UCSD class has gotten Rattle to work. Thanks to you and Github.

However, I cannot get graphics to work, and in fact on my machine, graphics cause R to crash. Rattle without graphics is not a good teaching platform, so I am spending Saturday trying to fix it. Any use of a Rattle plotting option, such as the Explore tab with Describe, creates the following error, in R. Rattle generates an empty new window to display the plot. caught segfault. address 0x4, cause ‘memory not mapped’ Traceback: 1:.Call(“doasCairoDevice”, widget, as.numeric(pointsize), w, h, PACKAGE = “cairoDevice”) 2: cairoDevice::asCairoDevice(da) 3: newPlot(pmax) 4: executeExplorePlot(avdataset) blah blah blah. Possible actions: 1: abort (with core dump, if enabled) 2: normal R exit 3: exit R without saving workspace 4: exit R saving workspace I’m using Rattle version 3.4.2, R version 3.1.3 on Mac OS 10.10.3 (or 10.10.2).

Re: building error and solution regarding the x11 pathways

Any suggestions about why R is quitting? Hi Ayan, did you install ggobi first? The instructions are in the README file that comes with rrgobi. Here they are.

Let me know if it works. Ggobi/rggobi on OS X Currently, the easiest way to get rggobi on OS X is to build Gtk2 and ggobi from source using homebrew. This is relatively simple: # Install homebrew (if you don’t already have it) ruby -e “$(curl -fsSL )” # Install ggobi from source brew install ggobi brew install libxml2 # Set up PKGCONFIGPATH so rggobi can find all the pieces PKGCONFIGPATH=/usr/local/lib/pkgconfig:/opt/X11/lib/pkgconfig:/usr/local/opt/libxml2/lib/pkgconfig R install.packages(“rggobi”, type = “source”). Hi Stephany, it seems like something is wrong with your attempt to install RGtk2, which is a necessary component to have Rattle work properly. Now it is not easy from here to tell where the problem actually is, let alone how to solve it. I would recommend you go over the installation steps again, paying attention to every detail, especially for what concerns the steps leading to RGtk2 installation.

Regarding Xquartz it is ok if you don’t see it, that should not be an issue. Please try again and let me know if you get any new/different result. Many people have succeeded with installing Rattle according to my instructions, but it took them a couple of tries before they got everything right. Best Regards, Marco. Hey Marco, RGtk2 and CairoDevice seem to have installed properly (terminal output at the end of those installs included at bottom), but Rattle installation fails at attempting to install rggobi. Any thoughts? Install.packages(“rggobi”) Package which is only available in source form, and may need compilation of C/C/Fortran: ‘rggobi’ Do you want to attempt to install these from sources?

Y/n: y installing the source package ‘rggobi’ trying URL ‘Content type ‘application/x-gzip’ length 137973 bytes (134 KB) downloaded 134 KB. installing.source. package ‘rggobi’. package ‘rggobi’ successfully unpacked and MD5 sums checked checking for pkg-config no checking for GGOBI no configure: error: in /private/var/folders/q6/pzc2mv17hn4kd1fd8tjbnhh0000gn/T/RtmpB8z2Ug/R.INSTALL155d57e2f87ef/rggobi': configure: error: The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKGCONFIG environment variable to the full path to pkg-config.

Alternatively, you may set the environment variables GGOBICFLAGS and GGOBILIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.

To get pkg-config, see. See config.log’ for more details ERROR: configuration failed for package ‘rggobi’. removing ‘/Library/Frameworks/R.framework/Versions/3.2/Resources/library/rggobi’ RGtk2 and CairoDevice installation:. R. demo. inst.

preparing package for lazy loading. help. installing help indices. building package indices. testing if installed package can be loaded. DONE (RGtk2).

R. demo. preparing package for lazy loading. help.

installing help indices. building package indices. testing if installed package can be loaded.

DONE (cairoDevice).