Sage: Ticket #29471: Failing doctest in R interface due to missing lattice library
https://trac.sagemath.org/ticket/29471
<p>
During automated testing with <a class="wiki" href="https://trac.sagemath.org/wiki/GitHub">GitHub</a> actions we get the following error on many debian and ubuntu distros:
</p>
<pre class="wiki">sage -t src/sage/interfaces/r.py
**********************************************************************
File "src/sage/interfaces/r.py", line 1318, in sage.interfaces.r.R.plot
Failed example:
r.library("lattice")
Exception raised:
Traceback (most recent call last):
File "/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 681, in _run
self.compile_and_execute(example, compiler, test.globs)
File "/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 1123, in compile_and_execute
exec(compiled, globs)
File "<doctest sage.interfaces.r.R.plot[5]>", line 1, in <module>
r.library("lattice")
File "/sage/local/lib/python2.7/site-packages/sage/interfaces/r.py", line 863, in library
raise ImportError("R library {} not installed".format(library_name))
ImportError: R library lattice not installed
</pre><p>
see e.g. <a class="ext-link" href="https://github.com/mkoeppe/sage/runs/542655815"><span class="icon"></span>https://github.com/mkoeppe/sage/runs/542655815</a>.
</p>
<p>
We fix this by adding the package <code>r-cran-lattice</code> to <code>build/pkgs/r/distros/debian.txt</code>.
</p>
<p>
In general this is expected behavior. If you skip the recommended packages of R (on your system) then your R interface in sage will not have all features. The error message is meaningful and the user should know what to do about it.
</p>
en-usSagehttps://trac.sagemath.org/chrome/site/logo_sagemath_trac.png
https://trac.sagemath.org/ticket/29471
Trac 1.1.6kcrismanMon, 06 Apr 2020 13:10:27 GMT
https://trac.sagemath.org/ticket/29471#comment:1
https://trac.sagemath.org/ticket/29471#comment:1
<p>
That is very interesting, and could only have happened as we allows system R now in some circumstances. I would be willing to bet there are other standard libraries that not every system R has that we configured to build in "our" R - maybe this ticket should be to ensure that system R has <em>all</em> of them. (They are really very standard so it's not a big burden, and if someone really wants to use a system R without them, then they just get failing doctests.)
</p>
<p>
In any case, don't do this as <code>not tested</code>, though - we would still want to test that Sage-the-library built from scratch passes its own doctests.
</p>
Ticketgh-kliemMon, 06 Apr 2020 14:04:14 GMT
https://trac.sagemath.org/ticket/29471#comment:2
https://trac.sagemath.org/ticket/29471#comment:2
<p>
On Debian and Ubuntu r-cran-lattice is a recommended package for r-base-core <a class="ext-link" href="https://packages.debian.org/buster/r-recommended"><span class="icon"></span>https://packages.debian.org/buster/r-recommended</a> (part of r-recommended).
</p>
<p>
If we require those packages in order to use the system R, we should do so at configure.
</p>
<p>
If we want this to be optional and still want to keep the doctest, I think we would need some flag like <code># optional -- r-recommended</code>. I don't know if this is even possible.
</p>
TicketmkoeppeMon, 06 Apr 2020 16:14:45 GMT
https://trac.sagemath.org/ticket/29471#comment:3
https://trac.sagemath.org/ticket/29471#comment:3
<p>
For context, in the automatic tests defined by <code>tox.ini</code> and <code>build/bin/write-dockerfile.sh</code> (which is what is run on <a class="wiki" href="https://trac.sagemath.org/wiki/GitHub">GitHub</a> Actions), packages are installed on Debian distributions using <code>apt-get install --no-install-recommends</code>.
</p>
<p>
If the <code>lattice</code> package is important (I don't know as I don't use R), we can certainly add <code>r-cran-lattice</code> to <code>build/pkgs/r/distros/debian.txt</code>.
</p>
Ticketgh-kliemMon, 06 Apr 2020 17:25:26 GMT
https://trac.sagemath.org/ticket/29471#comment:4
https://trac.sagemath.org/ticket/29471#comment:4
<p>
Thanks for clarifying. Then this is almost expected behavior. If you use a system <code>R</code> which doesn't have all recommended packages than you will have limited functionality. I would add that line just to make the <a class="wiki" href="https://trac.sagemath.org/wiki/GitHub">GitHub</a> actions pass. This is a small package (only around 1 MB if you already install r-base-core, which we do).
</p>
Ticketgh-kliemMon, 06 Apr 2020 17:25:44 GMTstatus changed; commit, branch, author set
https://trac.sagemath.org/ticket/29471#comment:5
https://trac.sagemath.org/ticket/29471#comment:5
<ul>
<li><strong>status</strong>
changed from <em>new</em> to <em>needs_review</em>
</li>
<li><strong>commit</strong>
set to <em>6a4580546f25fa62f38b3490e2d0120975371379</em>
</li>
<li><strong>branch</strong>
set to <em>public/29471</em>
</li>
<li><strong>author</strong>
set to <em>Jonathan Kliem</em>
</li>
</ul>
TicketgitMon, 06 Apr 2020 17:26:47 GMTcommit changed
https://trac.sagemath.org/ticket/29471#comment:6
https://trac.sagemath.org/ticket/29471#comment:6
<ul>
<li><strong>commit</strong>
changed from <em>6a4580546f25fa62f38b3490e2d0120975371379</em> to <em>65a31019a4af6a39b89ad903b378fa19ea303edb</em>
</li>
</ul>
<p>
Branch pushed to git repo; I updated commit sha1. New commits:
</p>
<table class="wiki">
<tr><td><a class="ext-link" href="https://git.sagemath.org/sage.git/commit/?id=65a31019a4af6a39b89ad903b378fa19ea303edb"><span class="icon"></span>65a3101</a></td><td><code>add r-cran-lattice for github workflows</code>
</td></tr></table>
Ticketgh-kliemTue, 07 Apr 2020 09:04:02 GMT
https://trac.sagemath.org/ticket/29471#comment:7
https://trac.sagemath.org/ticket/29471#comment:7
<p>
This seems to work:
</p>
<p>
<a class="ext-link" href="https://github.com/kliem/sage-test-27122/actions/runs/72102779"><span class="icon"></span>https://github.com/kliem/sage-test-27122/actions/runs/72102779</a>
</p>
Ticketgh-kliemTue, 07 Apr 2020 09:17:59 GMTdescription changed
https://trac.sagemath.org/ticket/29471#comment:8
https://trac.sagemath.org/ticket/29471#comment:8
<ul>
<li><strong>description</strong>
modified (<a href="/ticket/29471?action=diff&version=8">diff</a>)
</li>
</ul>
TicketmkoeppeWed, 08 Apr 2020 01:13:27 GMTstatus changed; reviewer set
https://trac.sagemath.org/ticket/29471#comment:9
https://trac.sagemath.org/ticket/29471#comment:9
<ul>
<li><strong>status</strong>
changed from <em>needs_review</em> to <em>positive_review</em>
</li>
<li><strong>reviewer</strong>
set to <em>Matthias Koeppe</em>
</li>
</ul>
<p>
LGTM
</p>
TicketvbraunSun, 12 Apr 2020 15:34:20 GMTstatus, branch changed; resolution set
https://trac.sagemath.org/ticket/29471#comment:10
https://trac.sagemath.org/ticket/29471#comment:10
<ul>
<li><strong>status</strong>
changed from <em>positive_review</em> to <em>closed</em>
</li>
<li><strong>resolution</strong>
set to <em>fixed</em>
</li>
<li><strong>branch</strong>
changed from <em>public/29471</em> to <em>65a31019a4af6a39b89ad903b378fa19ea303edb</em>
</li>
</ul>
Ticket