R versions and package managing in Binder

#1

Hi team,

I’ve had a couple of questions come to me via email regarding R on Binder. The first is how often is the version of R updated as the user considers 3.4.4, which is currently installed, to be old.

The other issue they have is that a couple of image rendering packages (gifski and ggimage) are not being found by the library() command in the script. Both are present on MRAN and their published date is earlier than the date given in runtime.txt. They were wondering if maybe there was an aspect of the Binder local environment causing this issue? Any advice would be greatly appreciated!

Here’s the repo in question: https://github.com/ajstewartlang/SNCF_TidyTuesday
And the binder link: https://mybinder.org/v2/gh/ajstewartlang/SNCF_TidyTuesday/master?urlpath=rstudio

1 Like
#2

This could be an issue with the library paths, see https://github.com/STAT545-UBC/Discussion/issues/250

#3

I think the best answer we have is “When someone asks”. Right now the team that looks after repo2docker doesn’t contain any active R users. This means we are flying a bit blind, especially because the goal of repo2docker is to follow where the community of each programming language goes, not lead the way. So if the people who emailed you have opinions and thoughts it would be great if you could direct them to the repo to open an issue.

(As always there is some technical discussion/work that needs to happen because it never is as easy as just updating something :frowning: )

We currently install R via Ubuntu’s package manager, so without work we are “stuck”.

There has been an idea to use conda-forge to install the R binary (not R packages). This would give us more flexibility and maybe even open the door for repos to specify which version of R they want in the repo, alongside the MRAN date.

#4

Many thanks. I’ve opened an issue at https://github.com/jupyter/repo2docker/issues/661 wrt different versions of R and a bit of rationale as to why this is important in the context of reproducible research in my area.

In terms of the package errors, I’ve checked things like the paths but suspect it’s something else. When trying to install ‘gifski’ the following error appears in RStudio in my Binder:

------------------ RUST COMPILER NOT FOUND --------------------

Cargo was not found on the PATH. Please install cargo / rustc:

  • yum install cargo (Fedora/CentOS)
  • apt-get install cargo (Debian/Ubuntu)
  • brew install rustc (MacOS)

Alternatively install Rust from: https://www.rust-lang.org


When trying to install ‘ggimage’, it looks like there’s a problem installing one of the dependencies (magick) as this error appears:

  • installing source package ‘magick’ …
    ** package ‘magick’ successfully unpacked and MD5 sums checked
    Package Magick++ was not found in the pkg-config search path.
    Perhaps you should add the directory containing `Magick++.pc’
    to the PKG_CONFIG_PATH environment variable
    No package ‘Magick++’ found
    Using PKG_CFLAGS=
    Using PKG_LIBS=-lMagick+±6.Q16
    ------------------------- ANTICONF ERROR ---------------------------
    Configuration failed because Magick++ was not found. Try installing:
  • deb: ‘libmagick+±dev’ (Debian, Ubuntu)
  • rpm: ‘ImageMagick-c+±devel’ (Fedora, CentOS, RHEL)
  • csw: ‘imagemagick_dev’ (Solaris)
    On MacOS it is recommended to use install ImageMagick-6 from homebrew
    with extra support for fontconfig and rsvg rendering:
    brew reinstall imagemagick@6 --with-fontconfig --with-librsvg
    For older Ubuntu versions Trusty (14.04) and Xenial (16.04) use our PPA:
    sudo add-apt-repository -y ppa:opencpu/imagemagick
    sudo apt-get update
    sudo apt-get install -y libmagick+±dev
    If Magick++ is already installed, check that ‘pkg-config’ is in your
    PATH and PKG_CONFIG_PATH contains a Magick++.pc file. If pkg-config
    is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
    R CMD INSTALL --configure-vars=‘INCLUDE_DIR=… LIB_DIR=…’

Which I’m not quite sure what to do with. I think Binder is a phenomenal idea btw with huge potential for improving reproducibility in research.

#5

This tells you that you need to install a rust compiler for gifski to work. The tool used to build images from repos that BinderHub uses is repo2docker and we have a special file called apt.txt where you can list packages that should be installed via apt-get: https://repo2docker.readthedocs.io/en/latest/config_files.html#apt-txt-install-packages-with-apt-get for some docs. Hopefully that will sort out the problem of the rust compiler.

I think for magick the solution is the same: install libmagick+±dev by adding it to a apt.txt in your repo.

Let us know how it goes!

#6

I am so pleased reading the issue you created. It lays out what is needed, why, how to get there and that you don’t know how much work it would be. Perfect.

For context: we only just introduced issue templates and we had a few discussions already (thanks @KirstieJane!) on what to put into them, which questions to ask, is it too long/too short, etc. So I am happy to see that with N=1 it isn’t a disaster :slight_smile: If you have some feedback (maybe in a new thread?) that would be interesting to help improve the template.

1 Like
#7

Many thanks for that pointer - I will try it tomorrow and report back!

#8

Hmm, I’ve created an apt.txt fie in my repo containing the line:

libmagick+±dev

But this error pops up when Binder is launched:

Step 49/60 : RUN apt-get -qq update && apt-get install --yes --no-install-recommends libmagick+±dev && apt-get -qq purge && apt-get -qq clean && rm -rf /var/lib/apt/lists/*
—> Running in 49e79e20efcd
Reading package lists…
Building dependency tree…
Reading state information…
E: Unable to locate package libmagick+±dev
E: Couldn’t find any package by regex ‘libmagick+±dev’

Which makes me thing I’m supposed to be specifying a path somewhere or need to pass to apt-get something additional/else. I had a look at the latex example for apt.txt but couldn’t figure out how to generalise it to installing magick and rustc.

#9

I think the problem is that discourse mangled the name of the package (the second + symbol has an underline for me or maybe it is meant to be a ±). I am pretty sure the package name doesn’t contain special characters like that and should be ibmagick++-dev. That is two + symbols followed by one -.

#10

Made a PR https://github.com/ajstewartlang/SNCF_TidyTuesday/pull/1

#11

Huge thanks, Tim! This has worked perfectly! If you launch my Binder:

https://mybinder.org/v2/gh/ajstewartlang/SNCF_TidyTuesday/master?urlpath=rstudio

and then run the animation_code.R script you will see a data visualisation involving animated train png images demonstrating the running total of delayed international train departures of SNCF (from an old Tidy Tuesday dataset).

Final repo here:

3 Likes