Skip to content

Transitioning from Mac to LInux?

21 messages · Carl Witthoft, Bert Gunter, Hervé Pagès +5 more

#
If I should ask over at r-sig-debian instead of here, please tell me. 
I don't wish to clog r-sig-mac with off-topic stuff.


I've been watching the massive headaches people are dealing with trying 
to keep R fully compatible with each MacOS X upgrade,  I'm wondering 
whether replacing my iMac (2009) with a new Mac really makes sense from 
an R - user point of view, as opposed to getting some inexpensive 
desktop and installing Linux.  I know I can run R and RStudio under 
Linux, for example,  but don't know what limitations, if any there are 
when it comes to building packages from source, getting compatible 
compilers,  and so on.

What have some of you 'power R users' discovered when/if you tried to 
build , or incorporate Bioconductor or other repository's packages under 
Linux?
#
As you are asking about R experience from Unix-alike OS users, I think
you would clearly do better to ask on the - debian and/or -fedora
sigs.

Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
On Wed, Apr 1, 2020 at 11:49 AM Carl Witthoft <carl at witthoft.com> wrote:
#
My 2 cents: Just go for the inexpensive desktop + Linux. Debian-based or 
RedHat-based distros are great for developing R/Bioconductor packages. 
I've been maintaining/troubleshooting package builds on 
Linux/Windows/Mac for 15 years and Linux is **by far** the easiest 
platform to deal with. Still a mystery to me why one would choose macOS 
for developing R/Bioconductor packages.

H.
On 4/1/20 11:48, Carl Witthoft wrote:

  
    
#
Carl,

I would argue that you won't really gain anything - if you use R the Linux-way (build R from sources), it would be the same on macOS and Linux - and some people do that. So for R I don't think there is a difference. I'm using Linux for everything other than my desktop/laptop and the main reason I'm sticking with macOS at the edge is the availability of software for dealing with the rest of the world (MS Office, Adobe, Apple Mail etc.). If you don't need any of it, then you may be happy with Linux. The biggest issue there tends to be setting up your machine as the hardware support is far less streamlined than on macOS. Some of my friends are running Linux on Mac hardware - but you need the be real expert for that.

Cheers,
Simon
#
Actually, you can easily run Linux in Virtual Box.

But I agree, with Homebrew there is tons of unix tools available from the command line, and then some.

el

?
Sent from Dr Lisse?s iPad Mini 5
On 1 Apr 2020, 23:42 +0200, Simon Urbanek <simon.urbanek at R-project.org>, wrote:

  
  
#
On 01/04/2020 2:48 p.m., Carl Witthoft wrote:
If your iMac is still working, try installing Ubuntu or some other Linux 
on it.  I think at that age Apple is no longer providing upgrades, but I 
just put Ubuntu on a 2008 iMac, and it works well.  (I needed to upgrade 
the memory, but that just cost $40 for 4 GB.)

So I got a $40 desktop, with a nice screen.

Duncan Murdoch
#
I am using Homebrew on a Mac (two Macs - one at home, one at work) instead of the official R package, and I did not have any problems after upgrades - maybe I am lucky, maybe not as picky in defining ?problem?, but my suggestion would be to try R from homebrew to install R. 

OK - no support from here - I know.

And homebrew has also binary versions. What is missing, is a hombrew R package repository. Maybe an idea to create one?


Cheers,

Rainer
--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)

Orcid ID: 0000-0002-7490-0066

Department of Evolutionary Biology and Environmental Studies
University of Z?rich
Office Y34-J-74
Winterthurerstrasse 190
8075 Z?rich
Switzerland

Office:	+41 (0)44 635 47 64
Cell:       	+41 (0)78 630 66 57
email:      Rainer.Krug at uzh.ch
		Rainer at krugs.de
Skype:     RMkrug

PGP: 0x0F52F982
#
AFAIK most people on that list would vote hard against installing R via homebrew for several reasons - maybe there should be a section about this on the R dev / CRAN page to address this topic, @Simon? Otherwise this will come up again and again.

Anyhow, this is also not relating to the initial topic of that thread and should probably discussed separately.
On 2. Apr 2020, 10:04 +0200, Rainer M Krug <Rainer at krugs.de>, wrote:

  
  
#
I do same, including Rstudio (Cask).

Once in a while after major updates I need to reinstall all my extra
packages, so I have written me a little script along the lines of

	#!/usr/local/bin/Rscript
	local({
		r <- getOption("repos")
		r["CRAN"] <- "https://cloud.r-project.org/"
		options(repos = r)
	})
	install.packages(c(
		"RMariaDB", "rstudioapi"
	))

made it 0755 and can run it from the command line. Put it in my
handbook so I don't forget and never looked back.


greetings, el
On 02/04/2020 10:03 am, Rainer M Krug wrote:
#
I think there is - at least it is clear to me (that is why I said ?no support from here?). Although I do not see the problem why, which is a different topic altogether.

I was fully aware of the opposition to my way of using R (homebrew), but I decided to post it anyway, as I think it is a valid and useful approach (different discussion!).
The OP states:

 I'm wondering whether replacing my iMac (2009) with a new Mac really makes sense from an R - user point of view

Which I think is addressed in my post.

Cheers,

Rainer

  
  
#
New thread :-)-O

I am wondering if I should not try to figure out how automate this.

Is there a way of (only) listing all user installed (additional) 
packages, ie not the ones that come with R?

I could then construct the below file automagically, and if I was 
really bothered and bored find out how to make Homebrew pre/post 
install scripts to automate this :-)-O

And, for the record, other than that, I can only recall one serious 
issue, when the openblas library got lost recently which was however 
fixed quite quickly. 


greetings, el
On 02/04/2020 10:17, Dr Eberhard W Lisse wrote:

  
    
#
On 02/04/2020 5:58 a.m., Dr Eberhard W Lisse wrote:
Look at the "Priority" column in installed.packages().  "base" is part 
of R, "recommended" is normally distributed with R. "recommended" 
packages can be updated after R is installed, "base" packages can't.

If you just copy all the packages to the new library that aren't already 
there, and run update.packages(checkBuilt = TRUE) R will re-install 
everything that was originally installed under an earlier version.

Duncan Murdoch
#
I had something similar in mind - here is my repo which collects ides (no code yet) https://github.com/rkrug/install

If you are interested, we could get this going.

If I understand correctly, this would be very useful in many cases.
That is a good idea. We should take this forward.
Cheers,

Rainer
--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)

Orcid ID: 0000-0002-7490-0066

Department of Evolutionary Biology and Environmental Studies
University of Z?rich
Office Y34-J-74
Winterthurerstrasse 190
8075 Z?rich
Switzerland

Office:	+41 (0)44 635 47 64
Cell:       	+41 (0)78 630 66 57
email:      Rainer.Krug at uzh.ch
		Rainer at krugs.de
Skype:     RMkrug

PGP: 0x0F52F982
#
Just for a minute let's ignore the fact that installing R via Homebrew 
is not considered a good option by the competent authorities (which 
sounds like a good enough reason to stay away from it). I'm still 
wondering: what's the benefit vs installing the official CRAN binary? 
Just curious.

Thanks,
H.
On 4/2/20 03:43, Rainer M Krug wrote:

  
    
#
Arguments against homebrew:

Not an official response, but in the past, homebrew was compiling everything on the local machine. This is not the case anymore, and the default installation in homebrew, installs a binary. 

All packages need to be installed from source. This takes time, but I had no problems with any of the packages I use.

Just some tidbits from previous discussions.

But I would like to also hear the official reason (no resources would be a good enough justification as well).

Arguments for homebrew: 

it is more Linux like, in the way that you have more control over the tools used. e.g. when still using the official R installation, I regularly used different versions of GDAL in R, GRASS, ?, which can cause inconsistencies.

The installation is done without requiring root privileges, which is a big advantage (as I see it).



Cheers,

Rainer
--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)

Orcid ID: 0000-0002-7490-0066

Department of Evolutionary Biology and Environmental Studies
University of Z?rich
Office Y34-J-74
Winterthurerstrasse 190
8075 Z?rich
Switzerland

Office:	+41 (0)44 635 47 64
Cell:       	+41 (0)78 630 66 57
email:      Rainer.Krug at uzh.ch
		Rainer at krugs.de
Skype:     RMkrug

PGP: 0x0F52F982
#
Argument for homebrew:

	brew upgrade

which will figure out what needs to be upgraded so I don't have 
manually keep track of it.


BTW, it usually pulls the binary, and these have worked without any 
issues for many years, the last time something went wrong on the 
Download and it pulled the source. I don't care either way.

Packages must be installed from source, but not as source. R will look 
for the package on CRAN like any other and usually takes the binary, 
sometimes asking whether it should take a (newer) source )of the 
package)

The first run of (re-)installing additional packages does indeed take 
some time, but it doesn't happen often.

The point is that there is a channel for issues with homebrew packages 
but few people (especially when desperate) will take the time :-)-O

greetings, el
02/04/2020 13:09, Rainer M Krug wrote:
[...]
#
Rainer,

I am definitively interested.

But, as a disclaimer, I am an elderly Gynecologist only dabbling in R
and a little in Perl :-)-O. 

el
On 02/04/2020 12:43, Rainer M Krug wrote:
[...]
#
That main objection is that people are mixing Homebrew with CRAN and vice-versa which leads to many problems. You cannot use packages from CRAN when using Homebrew, period, and you have to be really careful if you want to mix Homebrew libraries (not anything R-related) with CRAN (it is doable if you know what you're doing).

The fundamental issue is that package managers like Homebrew replace system libraries with their own (for new features/updates that the system libraries don't provide) which break anything that relies on the system library. Out of all the package managers Homebrew the only one that is trying to address the issue by trying to separate them, but even that has been diverging over time.

The second issue is that they are increasingly replacing toolchains (compilers) with their own builds, which makes everything incompatible in explosive ways (things just segfault). Making sure that a compiler toolchain is stable is actually non-trivial and many packager manager authors/maintainers have little experience with this. That used the be the primary reason to avoid them, because it was just normal that the released binaries were miscompiled and things would break all the time. Fortunately, I think that has gotten better over time.

If you stick only with Homebrew, then you're likely ok, but you're on your own and have to compile all packages form sources. Majority of our time as CRAN maintainers for the binary releases is about providing dependent libraries for packages and making sure things "just work". It is doable, just a lot of work, so by using Homebrew every user has to spend that time.

(FWIW I use Hombrew myself for tools, but not in /usr/local (I'm using /opt/brew) and I only put it on the PATH for the tools that I need, never to compile anything "native" against it.)

Cheers,
Simon
#
Thanks a lot for your detailed response - it is very much appreciated.
This is definitely true (and I assume, you are referring to CRAN binary packages).

But I am wondering: I am always installing from the normal CRAN mirrors, and my R installation (homebrew) always installs from source. I never use `type = ?source?`in the installation for packages. 

My question: when would I install incompatible packages (I assume, you mean binary packages for Mac) from CRAN?
This is true, but I did not encounter big problems. And this is, why I thought loud in suggesting to setup a (non official!) homebrew tap to install the packages, similar to how it is in linux (Debian).
And I think everybody really appreciates this and is VErY happy about it. This is essential work!
Doable: definitely. lot of work: in my experience not that much more.

Overall, I definitely agree, that the official distribution should stay the proper apple way. But there are circumstances, where these are delayed, or problems occur after macOS upgrades, which will delay the compilation of new ones (GRASS did not have Mac binaries for a long time due to this problem). 

So an alternative way of installing, community supported but approved, would be preferable. The r formula for homebrew has been installed in the last year more that 112.000 times (https://formulae.brew.sh/formula/r) so I think there is likely a rather large user base of R from homebrew. 

A first step in this direction, would be to either include homebrew in this list, or create a new R-sig-hoebrew list, which could become the home of these discussions.
Than you are completely in the cold and without support from homebrew? As far as I heard, in this case, everything is locally compiled and not using the binaries - correct?

Cheers, and thanks again for your very useful clarifications,

Rainer
--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)

Orcid ID: 0000-0002-7490-0066

Department of Evolutionary Biology and Environmental Studies
University of Z?rich
Office Y34-J-74
Winterthurerstrasse 190
8075 Z?rich
Switzerland

Office:	+41 (0)44 635 47 64
Cell:       	+41 (0)78 630 66 57
email:      Rainer.Krug at uzh.ch
		Rainer at krugs.de
Skype:     RMkrug

PGP: 0x0F52F982
#
Rainer,
Maybe you wouldn't but I have seen people do it.
I'm not sure what you refer to, but if there are issues, please let me know. If you don't report issues, they won't get fixed.
I'm not sure I'd like to go there. I would direct that to Homebrew as we have nothing to do with the formulae used there. However, that's not really my call.

Today another reason came up why I have an issue with Homebrew: people install compilers and similar tools and then use them instead of Xcode for everything outside of Homebrew. That is absolutely unsupported, because they have different runtime environments, so things break. Sometimes in subtle ways and things segfault at random points. The thing is, if people knew what they were doing, and Homebrew was only used by developers, it would be all fine - they'd know not to mix and match run-times. But most user don't.
No, binaries are used where it is safe. There may be a few bottles that don't like to be installed in a custom location. I have not seen issues with it. To be honest I think putting homebrew in /usr/local was a bad mistake as that causes a lot of problems since all 3rd party software installs there, so you get very quickly to completely broken state. As with all those things, it's predicated on full control so if you don't use anything but Homebrew ever it's ok. But pretty much all native open source packages/installers install into /usr/local so the moment you use one thing in addition to Homebrew things start breaking.

Cheers,
Simon
#
My question would be: how? Is the installation from binary forced when installing with that option?
No problems here - this was just an example, where a second "approved? (whatever that means) installation approach would be useful.
At homebrew, you have to get hold of the maintainer of that formula - which is often not that easy. Power user problems of a software can only be solved by a power user of that software - and writing a formula for homebrew, only requires a basic understanding of the program one is installing. So the questions would not only cover the ?how do I install R? type, but also related to packages in the follow up, which is definitely not homebrew-list material.
I definitely think there would be a possibility of adding a r-devel installation to homebrew for R, which would make it easier for developers to install R-devel.
That is good to know - maybe I?ll try it out sometime, as I would prefer homebrew in /opt/brew.
I absolutely agree. This created such a mess, as even homebrew casks sometimes install in /usr/local.

Cheers,

Rainer
--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)

Orcid ID: 0000-0002-7490-0066

Department of Evolutionary Biology and Environmental Studies
University of Z?rich
Office Y34-J-74
Winterthurerstrasse 190
8075 Z?rich
Switzerland

Office:	+41 (0)44 635 47 64
Cell:       	+41 (0)78 630 66 57
email:      Rainer.Krug at uzh.ch
		Rainer at krugs.de
Skype:     RMkrug

PGP: 0x0F52F982