R installs on High-Sierra without tcl-tk support?


(Seth Fore) #11

For any still interested in this…

I’ve gotten the same errors using a brewed copy of tcl-tk after modifying the r.rb formula args section as indicated in your post. The solution, in my case, was to point the --with-tcl-config and --with-tk-config arguments to the system tcltk frameworks:

--with-tcl-config=/System/Library/Frameworks/Tcl.Framework/tclConfig.sh
--with-tk-config=/System/Library/Frameworks/Tk.Framework/tkConfig.sh

While those formula edits are pretty straight-forward and have worked for me in the past, after a recent Mac OS update I found I could no longer brew r with tcltk support. Upon inspection the tcltk config files were no longer present where they were expected. It turned out that the update removed my Command Line Tools and, unbeknownst to me (perhaps obvious to other who know more about this stuff than I do), the tclConfig.sh and tkConfig.sh files are only present when CLT is installed. After reinstalling CLT the formula installed as usual with tcl-tk support.


(Rainer M Krug) #12

Great.

Is there a chance, that you could share this in a user tap and post the address here?


(Seth Fore) #13

Sure. FYI, there are various other R capabilities for which I’ve added formula dependencies (e.g., lines 26-31). All of my edits are prefaced by comment # SRF - This is a formula edit .... All of my modifications aside from those that directly relate to tcl-tk capabilities have been commented out. You do need to have X11/XQuartz installed since tk.h includes some X11 headers. Additional R capabilities can be by compiled by editing the formula and commenting/uncommenting the appropriate lines provided the necessary downstream dependencies are available (e.g., Tex, …).

The modified r formula is available on github:

  • https://github.com/sethrfore/homebrew-r-srf.git

or can be directly tapped/installed via homebrew:

  • brew install -s sethrfore/homebrew-r-srf/r

While this works for me, I have comparatively limited experience with all of this stuff so use it for what it’s worth. If it errors out, post the details.


(Auklet) #14

The current homebrew R version without tcl-tk, without X11, ending up without png or jpeg device support is severely crippled and breaks a lot of my existing code. Thank you for sharing your formula, Seth! Downloaded it from github, still trying to figure out how to run it. Unfortunately, direct installation of formula did not work for me (No available formula with the name “sethrfore/r-srf/r.rb” ). In short, this is a plea to reconsider the decision to cut tcl-tk from the default homebrew R formula. Tcl-tk is part of the standard R environment. If I’d only want to aqua device, I’d simply use the r-app, as suggested. Thank you for making R available on homebrew and thank you for the consideration


(Mike McQuaid) #15

macOS comes without X11 so we don’t build X11 support. If it can build against Tcl/tk without adding an X11 dependency: please create a pull request to the R formula. We don’t intentionally disable it.


(Seth Fore) #16

The formula has been updated and remains available at https://github.com/sethrfore/homebrew-r-srf.git. After updating your tap, run:

  • brew info sethrfore/r-srf/r

This should show you the available build options. To install tapped formula, run:

  • brew install sethrfore/r-srf/r

with any build options appended.


(Seth Fore) #17

Building without X11 would require editing the tk.h header file in the base r tcltk package as noted in the R Installation and Administration documentation (https://cran.r-project.org/doc/manuals/r-release/R-admin.html#Tcl_002fTk). While other workarounds may well be more appropriate and elegant, they likely surpass my limited developer skillset. From a philosophical perspective, I certainly understand the rational for limiting formula dependencies to those supported on macOS.


(Sander W Van Der Laan) #18

Hi,
These postings seem relevant for my issue, which I describe here as well.

So, am I to understand @srfore, that I should perhaps try the following?

  • re-install Command Line Tools
  • do brew cask uninstall xquartz && brew uninstall r
  • reboot
  • do brew install tcl-tk
  • re-install XQuartz using brew cask install xquartz
  • re-install ‘your’ version of R using brew install -s sethrfore/homebrew-r-srf/r

Thanks and best,

Sander


(Sander W Van Der Laan) #19

Hi,

I proceeded with the above ‘protocol’. And I have written a post on my website on this matter.

These discussions were just the thing I needed, providing the clues to the solution. Thank you!

Best,

Sander


(Seth Fore) #20

If things are working, great. However, after looking at your install method and blog post, there is a clarification or two I should make. Foremost, the formula relies on the macOS system tcl-tk framework (formula lines 65-66)

so there is no need to brew tcl-tk or edit your bash_profile or PATH variable. As an aside, brew install ... scrubs your PATH variable so your brewed tcl-tk package would remain unaccessible unless you include the --env=std install argument anyway.

If for some reason you wanted to use a brewed tcl-tk framework, you’d have to further edit the r.rb formula and likely the tcl-tk.rb formula as well since tk is compiled using --without-x (tcl-tk formula line 71) and possibly others.

So long as xQuartz and CLT are installed and operational, you should not have to reinstall them.

After completing an R installation, running capabilities() in an R session will tell you what tools you actually have access to including tcl-tk. In order to make sure tcl-tk works, run a simple test script. Regardless, if everything is working as it should, great.


(Martin Häcker) #21

I have filed this as an issue here: https://github.com/Homebrew/homebrew-core/issues/28926 so there is a place to coordinate working on this.


(Seth Fore) #22

Installing the modified R formula referenced in the above discussion does provide tcl-tk support by leveraging the OS tcl-tk framework.

This workaround, albeit imperfect, should provide tcl-tk support if that is all you are looking for.

Speaking strictly for myself and the repo I maintain, I’d be happy to coordinate working on any issues you may have, however, I’m not exactly clear on what they are. A little clarification on what you’d like coordinate work on would be a useful first step.


(Martin Häcker) #23

Oh, the issue I’d like to collaborate on, is to get this back into Homebrew proper, as R is pretty much unusable without tcltk and the tiff, png, jpeg abilities.


(Luis Puerto) #24

You should review the threads on this topic. As far as I understood, maintainers made it clear that this isn’t going to come back since its optional and options are problematic.
Seems that long term goal is strip core formulae of all the options.


(Seth Fore) #25

All of the options you indicate are currently available from the custom tap referenced throughout the thread.


(Mike McQuaid) #26

If it can be done without adding a dependency on X11 or needing patches that haven’t been merged upstream it will likely be accepted it you create a pull request.

This is hyperbole. Looking at the analytics I suspect some of the 7,254 people who installed it in the last 30 days would disagree with you.


(Luis Puerto) #27

Well, it’s true that it is usable… but it isn’t a complete product. If you need the missing parts for your analysis, it’s probably pretty unusable.


(Jal Frezie) #28

How many of those people installed it, found that TclTk didn’t work, and went off and installed the binary distribution from CRAN instead, like me?


(Luis Puerto) #29

This is a really good question!


(Mike McQuaid) #30

This conversation is not helpful. I’ve said what’s necessary to get this formula changed (submit a PR that meets the requirements above). Locking.