Sage: Ticket #25503: Allow the use of system's R installation
https://trac.sagemath.org/ticket/25503
<p>
The aim of this ticket is to allow Sage to use the system's <code>R</code>, instead of building its own.
</p>
<p>
It should work for:
</p>
<ul><li><code>sage -R</code> command
</li><li>Sage's <code>r</code> interface
</li><li>Sage's <code>rpy2</code> Python package
</li><li>Sage's jupyter <code>IRkernel</code>
</li></ul><p>
Similarly to the way one can decide to use the system ATLAS when building Sage,
on the user side, building Sage so that it uses the system R is achieved by setting
the <code>SAGE_R_LIB</code> environment variable.
</p>
<p>
To test this ticket, you should at least:
</p>
<ul><li>install <code>R</code> on your system (e.g. <code>sudo apt install r-base</code>)
</li><li>reinstall <code>r</code> and <code>rpy2</code> with <code>SAGE_R_LIB</code> set:
<pre class="wiki">export SAGE_R_LIB=/usr/lib/R/
sage -f r
sage -f rpy2
make build
</pre></li><li>test Sage <code>R</code> command (this should/might show a different version than 3.4.4):
<pre class="wiki">sage -R
</pre></li><li>test Sage's <code>R</code> interface:
<pre class="wiki">sage -t --long src/sage/interfaces/r.py
</pre></li><li>test <code>rpy2</code>:
<pre class="wiki">sage -t --long src/sage/stats/r.py
</pre></li></ul>en-usSagehttps://trac.sagemath.org/chrome/site/logo_sagemath_trac.png
https://trac.sagemath.org/ticket/25503
Trac 1.2Thierry MonteilMon, 04 Jun 2018 12:41:08 GMTbranch set
https://trac.sagemath.org/ticket/25503#comment:1
https://trac.sagemath.org/ticket/25503#comment:1
<ul>
<li><strong>branch</strong>
set to <em>u/tmonteil/allow_the_use_of_system_s_r_installation</em>
</li>
</ul>
TicketThierry MonteilMon, 04 Jun 2018 12:52:38 GMTstatus, description changed; cc, commit set
https://trac.sagemath.org/ticket/25503#comment:2
https://trac.sagemath.org/ticket/25503#comment:2
<ul>
<li><strong>cc</strong>
<em>Emmanuel Charpentier</em> <em>Erik Bray</em> added
</li>
<li><strong>commit</strong>
set to <em>eed2ea352af29fa6e6fb65d274c2e0078a7c07a6</em>
</li>
<li><strong>status</strong>
changed from <em>new</em> to <em>needs_review</em>
</li>
<li><strong>description</strong>
modified (<a href="/ticket/25503?action=diff&version=2">diff</a>)
</li>
</ul>
<p>
New commits:
</p>
<table class="wiki">
<tr><td><a class="ext-link" href="https://git.sagemath.org/sage.git/commit?id=380a2b0e7a0f375e40be1329d890d0a73f324c92"><span class="icon"></span>380a2b0</a></td><td><code>#25503 : do not build R if SAGE_R_LIB is set</code>
</td></tr><tr><td><a class="ext-link" href="https://git.sagemath.org/sage.git/commit?id=e8768ed5d0af6683fbdf3775f29c13047cbdecee"><span class="icon"></span>e8768ed</a></td><td><code>#25503 : let rpy2 use SAGE_R_LIB for its RHOMES variable</code>
</td></tr><tr><td><a class="ext-link" href="https://git.sagemath.org/sage.git/commit?id=0519cda83d2fe9ecb2cf1214ea86acf15df405e3"><span class="icon"></span>0519cda</a></td><td><code>#25503 : fix issue between R interface and readline 7</code>
</td></tr><tr><td><a class="ext-link" href="https://git.sagemath.org/sage.git/commit?id=eed2ea352af29fa6e6fb65d274c2e0078a7c07a6"><span class="icon"></span>eed2ea3</a></td><td><code>#25503 : document the SAGE_R_LIB variable in the install guide</code>
</td></tr></table>
TicketThierry MonteilMon, 04 Jun 2018 13:15:09 GMTdescription changed
https://trac.sagemath.org/ticket/25503#comment:3
https://trac.sagemath.org/ticket/25503#comment:3
<ul>
<li><strong>description</strong>
modified (<a href="/ticket/25503?action=diff&version=3">diff</a>)
</li>
</ul>
TicketThierry MonteilMon, 04 Jun 2018 15:11:43 GMT
https://trac.sagemath.org/ticket/25503#comment:4
https://trac.sagemath.org/ticket/25503#comment:4
<p>
We should probably also update <code>sage-env</code> script, which explicitly unset <code>R</code>-related variables that the user could set in relation with system-wide install.
</p>
TicketSamuel LelièvreMon, 04 Jun 2018 18:03:52 GMTcc, description changed; keywords set
https://trac.sagemath.org/ticket/25503#comment:5
https://trac.sagemath.org/ticket/25503#comment:5
<ul>
<li><strong>cc</strong>
<em>François Bissey</em> <em>Karl-Dieter Crisman</em> <em>Samuel Lelièvre</em> added
</li>
<li><strong>keywords</strong>
<em>R</em> added
</li>
<li><strong>description</strong>
modified (<a href="/ticket/25503?action=diff&version=5">diff</a>)
</li>
</ul>
TicketAndrey NovoseltsevMon, 04 Jun 2018 18:40:04 GMT
https://trac.sagemath.org/ticket/25503#comment:6
https://trac.sagemath.org/ticket/25503#comment:6
<p>
So - if a system-wide install is used, does it mean that the standard R configuration files will be picked up? With its own R Sage makes sure that nothing is used.
</p>
TicketThierry MonteilMon, 04 Jun 2018 18:48:55 GMT
https://trac.sagemath.org/ticket/25503#comment:7
https://trac.sagemath.org/ticket/25503#comment:7
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/25503#comment:6" title="Comment 6">novoselt</a>:
</p>
<blockquote class="citation">
<p>
So - if a system-wide install is used, does it mean that the standard R configuration files will be picked up?
</p>
</blockquote>
<p>
I would say yes (see my last comment about <code>sage-env</code>), though i might be wrong. I guess that if a user explicitly ask Sage to use system-wide <code>R</code>, it means that she want to keep all control (e.g. on where to install things, etc).
</p>
TicketTimo KaufmannWed, 11 Jul 2018 17:49:32 GMTcc changed
https://trac.sagemath.org/ticket/25503#comment:8
https://trac.sagemath.org/ticket/25503#comment:8
<ul>
<li><strong>cc</strong>
<em>Timo Kaufmann</em> added
</li>
</ul>
TicketThierry MonteilTue, 17 Jul 2018 16:04:55 GMT
https://trac.sagemath.org/ticket/25503#comment:9
https://trac.sagemath.org/ticket/25503#comment:9
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/25503#comment:6" title="Comment 6">novoselt</a>:
</p>
<blockquote class="citation">
<p>
So - if a system-wide install is used, does it mean that the standard R configuration files will be picked up?
</p>
</blockquote>
<p>
Yes.
</p>
<blockquote class="citation">
<p>
With its own R Sage makes sure that nothing is used.
</p>
</blockquote>
<p>
It is up to the user to decide whether she wants to use the system's R or Sage's R, the default remains to build and use Sage's R.
</p>
TicketJulian RüthSun, 14 Oct 2018 19:22:50 GMTstatus changed
https://trac.sagemath.org/ticket/25503#comment:10
https://trac.sagemath.org/ticket/25503#comment:10
<ul>
<li><strong>status</strong>
changed from <em>needs_review</em> to <em>needs_work</em>
</li>
</ul>
<p>
I would be curious to hear embray's opinion on this. I know that he has been working on allowing to use system packages more generally.
</p>
<p>
Btw, there are merge conflicts.
</p>
TicketJohn PalmieriSun, 14 Oct 2018 21:10:57 GMT
https://trac.sagemath.org/ticket/25503#comment:11
https://trac.sagemath.org/ticket/25503#comment:11
<p>
Why should this work for the <code>sage -R</code> command? That command is explicitly documented (as in <code>sage --help</code> and in <a class="ext-link" href="http://doc.sagemath.org/html/en/reference/repl/options.html#command-line-options-for-sage"><span class="icon"></span>the reference manual</a>) to "run Sage's R with given arguments", so why should it run a non-Sage R? Maybe I'm misunderstanding.
</p>
<p>
I think that any installation of Sage which does not install its own R, Python, Singular, etc., should not have functioning <code>sage --python</code>, <code>sage -R</code>, <code>sage --singular</code>, etc., commands. Maybe instead, those commands should provide good error messages if Sage is configured to use a system version of the appropriate software.
</p>
<p>
But if you really want <code>sage -R</code> to work with a non-Sage version of <code>R</code>, please change the documentation.
</p>
TicketFrançois BisseySun, 14 Oct 2018 21:18:40 GMT
https://trac.sagemath.org/ticket/25503#comment:12
https://trac.sagemath.org/ticket/25503#comment:12
<p>
I never changed those help messages in sage-on-gentoo. There is an ambiguity I am exploiting. You think it only means R from sage the distribution, I take it to mean R that sage has been configured to use. You could argue that the capitalisation means we are talking about the distribution.
</p>
<p>
Should we have a semantic war :)
</p>
<p>
In any case, while there is no real benefit, compared to running R directly, I don't see why the behavior shouldn't be preserved. Existing scripts shouldn't break because you changed some underlying bits.
</p>
TicketFrançois BisseySun, 14 Oct 2018 22:02:56 GMT
https://trac.sagemath.org/ticket/25503#comment:13
https://trac.sagemath.org/ticket/25503#comment:13
<p>
Seriously, if changing the documentation is your only problem with this, I'd be glad to just do that. Do you have a preferred wording?
</p>
TicketJohn PalmieriMon, 15 Oct 2018 04:34:35 GMT
https://trac.sagemath.org/ticket/25503#comment:14
https://trac.sagemath.org/ticket/25503#comment:14
<p>
I think that if the system has <code>R</code> installed, people should run it by running <code>R</code>, not <code>sage -R</code>. So I think if Sage is going to use the system's <code>R</code>, there is no need for command <code>sage -R</code> – it adds the 6 extra characters <code>sage -</code> for no reason – and it should be disabled.
</p>
TicketFrançois BisseyMon, 15 Oct 2018 04:38:53 GMT
https://trac.sagemath.org/ticket/25503#comment:15
https://trac.sagemath.org/ticket/25503#comment:15
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/25503#comment:14" title="Comment 14">jhpalmieri</a>:
</p>
<blockquote class="citation">
<p>
I think that if the system has <code>R</code> installed, people should run it by running <code>R</code>, not <code>sage -R</code>. So I think if Sage is going to use the system's <code>R</code>, there is no need for command <code>sage -R</code> – it adds the 6 extra characters <code>sage -</code> for no reason – and it should be disabled.
</p>
</blockquote>
<p>
So you don't think we should support people with old script that may call <code>sage -R</code>? You want those people to update?
</p>
TicketJohn PalmieriMon, 15 Oct 2018 05:35:00 GMT
https://trac.sagemath.org/ticket/25503#comment:16
https://trac.sagemath.org/ticket/25503#comment:16
<p>
If Sage is not going to install a copy of <code>R</code>, then you could rewrite the main <code>sage</code> script so that <code>sage -R</code> prints a deprecation warning before executing the system's R`.
</p>
<p>
I don't really buy your ambiguity argument, and I think that you are misleading people if <code>sage -R</code> runs a version of R which was not installed by Sage. (There is also the slim chance that it won't work and people will report errors from running <code>sage -R</code> to Sage developers, or (even worse) silently blame us for the problem, when it has nothing to do with us.)
</p>
<p>
How many people really use commands like <code>sage -R</code>? Maybe they should all be deprecated, and people should be encouraged to put <code>SAGE_ROOT/local/bin</code> in their path or instead to use <code>sage --sh -c blah</code>, where <code>blah</code> can be <code>R</code> or <code>python</code> or <code>ecl</code> or ...
</p>
<p>
If you really want to proceed, note that <code>sage -h</code> contains
</p>
<pre class="wiki"> -cython [...] -- run Cython with given arguments
-ecl [...] -- run Common Lisp
-gap [...] -- run Sage's Gap with given arguments
</pre><p>
so maybe they should all omit "Sage's". I won't be happy with that change, so you'll need another reviewer, and I also think you should ask for more opinions.
</p>
TicketTimo KaufmannTue, 16 Oct 2018 08:26:08 GMT
https://trac.sagemath.org/ticket/25503#comment:17
https://trac.sagemath.org/ticket/25503#comment:17
<p>
For what its worth I agree with @fbissey's interpretation. Even a distro can have multiple versions of a dependency installed. Sometimes it can be useful to "start the R sage uses", for example for debugging.
</p>
TicketSamuel LelièvreTue, 16 Oct 2018 09:13:51 GMT
https://trac.sagemath.org/ticket/25503#comment:18
https://trac.sagemath.org/ticket/25503#comment:18
<p>
I would also agree with interpreting "Sage's R" as "the R that Sage has been configured to use",
and similarly for GAP, PARI/GP, Singular, etc.
</p>
TicketFrançois BisseyTue, 16 Oct 2018 09:22:36 GMT
https://trac.sagemath.org/ticket/25503#comment:19
https://trac.sagemath.org/ticket/25503#comment:19
<p>
I think John feels very strongly about his interpretation. The heart of his argument being if it says it is sage's own, the sage devs owns the bugs. As distros guys we all know where to stand about that.
</p>
<p>
Sometimes it is your own bugs (build system, distro specificities) and sometimes it belong to upstream. In any case you may carry patches and sage-the-distro has a long history about "owning" its own patches regardless of upstream as you well know.
</p>
<p>
In any case piping on the matter on sage-devel doesn't cost us much since it is now, in effect, a sage-8.5 ticket.
</p>
TicketTimo KaufmannTue, 16 Oct 2018 16:01:45 GMT
https://trac.sagemath.org/ticket/25503#comment:20
https://trac.sagemath.org/ticket/25503#comment:20
<p>
I don't feel very strongly about it either way, maybe printing a clear information (either "this is a sage package" or "this is a system package") first is a good compromise.
</p>
TicketErik BraySun, 28 Oct 2018 16:03:32 GMT
https://trac.sagemath.org/ticket/25503#comment:21
https://trac.sagemath.org/ticket/25503#comment:21
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/25503#comment:11" title="Comment 11">jhpalmieri</a>:
</p>
<blockquote class="citation">
<p>
I think that any installation of Sage which does not install its own R, Python, Singular, etc., should not have functioning <code>sage --python</code>, <code>sage -R</code>, <code>sage --singular</code>, etc., commands. Maybe instead, those commands should provide good error messages if Sage is configured to use a system version of the appropriate software.
</p>
<p>
But if you really want <code>sage -R</code> to work with a non-Sage version of <code>R</code>, please change the documentation.
</p>
</blockquote>
<p>
I disagree. I think these commands should really just mean "run the same Python/R/etc. that Sage is using, with all the sage-related environment variables set".
</p>
TicketErik BraySun, 28 Oct 2018 16:06:41 GMT
https://trac.sagemath.org/ticket/25503#comment:22
https://trac.sagemath.org/ticket/25503#comment:22
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/25503#comment:14" title="Comment 14">jhpalmieri</a>:
</p>
<blockquote class="citation">
<p>
I think that if the system has <code>R</code> installed, people should run it by running <code>R</code>, not <code>sage -R</code>. So I think if Sage is going to use the system's <code>R</code>, there is no need for command <code>sage -R</code> – it adds the 6 extra characters <code>sage -</code> for no reason – and it should be disabled.
</p>
</blockquote>
<p>
That's not true that there is no reason for it. For example, what if you want to run R in the Sage environment so that you can run sage commands in R with RPy? Or interface with other software that is included in the Sage distribution? From the user's perspective, <code>sage -R</code> means "launch the R that sage is using". It's transparent/irrelevant whether or not the R command happened to be included in the Sage distribution or not. For downstream distributions (e.g. on Debian, Gentoo) they are all using the system's copies of programs as much as possible, so you'll just have confused users who find that <code>sage -R</code> works on some system but not others.
</p>
TicketErik BraySun, 28 Oct 2018 16:07:23 GMTmilestone changed
https://trac.sagemath.org/ticket/25503#comment:23
https://trac.sagemath.org/ticket/25503#comment:23
<ul>
<li><strong>milestone</strong>
changed from <em>sage-8.3</em> to <em>sage-wishlist</em>
</li>
</ul>
TicketThierry MonteilTue, 27 Aug 2019 19:45:19 GMTkeywords changed
https://trac.sagemath.org/ticket/25503#comment:24
https://trac.sagemath.org/ticket/25503#comment:24
<ul>
<li><strong>keywords</strong>
<em>sdl</em> added
</li>
</ul>
TicketDima PasechnikSun, 15 Dec 2019 00:52:01 GMT
https://trac.sagemath.org/ticket/25503#comment:25
https://trac.sagemath.org/ticket/25503#comment:25
<p>
I've opened <a class="closed ticket" href="https://trac.sagemath.org/ticket/28884" title="#28884: enhancement: spkg-configure for R (closed: fixed)">#28884</a> with a working (on Debian at least) branch allowing use of system's R.
</p>
<p>
Feel free to review.
</p>
TicketMichael OrlitzkyWed, 18 Mar 2020 23:26:29 GMTcc changed
https://trac.sagemath.org/ticket/25503#comment:26
https://trac.sagemath.org/ticket/25503#comment:26
<ul>
<li><strong>cc</strong>
<em>Michael Orlitzky</em> added
</li>
</ul>
<p>
Is there still anything to do here? I don't really use R inside or outside of sage... has <a class="closed ticket" href="https://trac.sagemath.org/ticket/28884" title="#28884: enhancement: spkg-configure for R (closed: fixed)">#28884</a> caused any problems?
</p>
TicketDima PasechnikThu, 19 Mar 2020 03:44:04 GMTstatus, milestone changed; reviewer set
https://trac.sagemath.org/ticket/25503#comment:27
https://trac.sagemath.org/ticket/25503#comment:27
<ul>
<li><strong>status</strong>
changed from <em>needs_work</em> to <em>positive_review</em>
</li>
<li><strong>reviewer</strong>
set to <em>Dima Pasechnik</em>
</li>
<li><strong>milestone</strong>
changed from <em>sage-wishlist</em> to <em>sage-duplicate/invalid/wontfix</em>
</li>
</ul>
<p>
not sure about Jupyter kernel for R, but this is a different story. A new ticket, if you must.
</p>
TicketFrédéric ChapotonFri, 27 Mar 2020 15:07:21 GMTstatus changed; resolution set
https://trac.sagemath.org/ticket/25503#comment:28
https://trac.sagemath.org/ticket/25503#comment:28
<ul>
<li><strong>status</strong>
changed from <em>positive_review</em> to <em>closed</em>
</li>
<li><strong>resolution</strong>
set to <em>duplicate</em>
</li>
</ul>
Ticket