#29471 closed defect (fixed)

Failing doctest in R interface due to missing lattice library

Reported by: gh-kliem Owned by:
Priority: major Milestone: sage-9.1
Component: packages: standard Keywords: R, spkg-configure, lattice library
Cc: tmonteil, fbissey, isuruf, charpent, embray, dimpase Merged in:
Authors: Jonathan Kliem Reviewers: Matthias Koeppe
Report Upstream: N/A Work issues:
Branch: 65a3101 (Commits, GitHub, GitLab) Commit: 65a31019a4af6a39b89ad903b378fa19ea303edb
Dependencies: Stopgaps:

Status badges

Description (last modified by gh-kliem)

During automated testing with GitHub actions we get the following error on many debian and ubuntu distros:

sage -t src/sage/interfaces/r.py
File "src/sage/interfaces/r.py", line 1318, in sage.interfaces.r.R.plot
Failed example:
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>
      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

see e.g. https://github.com/mkoeppe/sage/runs/542655815.

We fix this by adding the package r-cran-lattice to build/pkgs/r/distros/debian.txt.

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.

Change History (10)

comment:1 Changed 20 months ago by kcrisman

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 all 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.)

In any case, don't do this as not tested, though - we would still want to test that Sage-the-library built from scratch passes its own doctests.

comment:2 Changed 20 months ago by gh-kliem

On Debian and Ubuntu r-cran-lattice is a recommended package for r-base-core https://packages.debian.org/buster/r-recommended (part of r-recommended).

If we require those packages in order to use the system R, we should do so at configure.

If we want this to be optional and still want to keep the doctest, I think we would need some flag like # optional -- r-recommended. I don't know if this is even possible.

comment:3 follow-up: Changed 20 months ago by mkoeppe

For context, in the automatic tests defined by tox.ini and build/bin/write-dockerfile.sh (which is what is run on GitHub Actions), packages are installed on Debian distributions using apt-get install --no-install-recommends.

If the lattice package is important (I don't know as I don't use R), we can certainly add r-cran-lattice to build/pkgs/r/distros/debian.txt.

comment:4 Changed 20 months ago by gh-kliem

Thanks for clarifying. Then this is almost expected behavior. If you use a system R which doesn't have all recommended packages than you will have limited functionality. I would add that line just to make the GitHub actions pass. This is a small package (only around 1 MB if you already install r-base-core, which we do).

comment:5 Changed 20 months ago by gh-kliem

  • Authors set to Jonathan Kliem
  • Branch set to public/29471
  • Commit set to 6a4580546f25fa62f38b3490e2d0120975371379
  • Status changed from new to needs_review

comment:6 Changed 20 months ago by git

  • Commit changed from 6a4580546f25fa62f38b3490e2d0120975371379 to 65a31019a4af6a39b89ad903b378fa19ea303edb

Branch pushed to git repo; I updated commit sha1. New commits:

65a3101add r-cran-lattice for github workflows

comment:8 in reply to: ↑ 3 Changed 20 months ago by gh-kliem

  • Description modified (diff)

comment:9 Changed 20 months ago by mkoeppe

  • Reviewers set to Matthias Koeppe
  • Status changed from needs_review to positive_review


comment:10 Changed 20 months ago by vbraun

  • Branch changed from public/29471 to 65a31019a4af6a39b89ad903b378fa19ea303edb
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.