Hell Hath No Fury Like a Dependency Scorned

Written by: Paul Rubin

Primary Source: OR in an OB World

There is a recent package for the R statistics system named “Radiant”, available either through the CRAN repository or from the author’s GitHub site. It runs R in the background and lets you poke at data in a browser interface. If you are looking for a way to present data to end-users and let them explore the data dynamically, rather than looking at a bunch of static plots, you might find radiant rather useful.

So I set out to install it, first on my PC and then, when that failed, on my laptop. If you look at the CRAN page, you can see which other R packages radiant requires. That’s interesting but not terribly crucial, since the R package installation system by default handles dependencies for you.

The problem is that the package installer will compile radiant, and its various dependencies, on your system, or in my case die trying. What is not visible (with radiant or any other R package) is which non-R compilers and libraries are required. As it turns out, beyond the usual suspects (mainly gcc, the GNU C++ compiler, which I think is a given on pretty much every Linux installation), radiant (or some of its dependencies) requires the GNU FORTRAN compiler (gfortran), which I had on my PC but not my laptop. That much was easy to figure out.

Harder to understand were compilation error messages for some of the dependencies saying “cannot find -lblas” and “cannot find -llapack”. For the nontechnical user, even finding those messages in the torrent of compiler output might be a bit iffy. As it happens, I know enough (just barely) to know that “-l” is a prefix telling the compiler to load a library and “blas” and “lapack” were the library names. As it happens, I even know that “blas” is the Basic Linear Algebra Subprograms library and “lapack” is the Linear Algebra Package library. What I did not know was why the compiler could not find them, given that both libraries are installed on both machines.

Trial and error yielded an answer: the compiler needs the static versions of both. Rather ironically, the Wikipedia entry for static libraries (the immediate preceding link) lists one advantage of static libraries over their dynamic counterparts (the ones I already had installed) as “… avoid[ing] dependency problems, known colloquially as DLL Hell or more generally dependency hell“. Little do they know …

Anyway, on Linux Mint (or, presumably, Ubuntu), you can find them listed in the Synaptic package manager under “libblas-dev” and “liblapack-dev”. Install those first (along with “gfortran” if not already installed) using Synaptic or apt (from a command line), then install radiant and its dependencies from CRAN using R, and things should go fairly smoothly. For Windows or Mac users, you’ll need the same two libraries, but I’m afraid you’re on your own finding them.

The following two tabs change content below.
I'm an apostate mathematician, retired from a business school after 33 years of teaching mostly (but not exclusively) quantitative methods courses. My academic interests lie in operations research. I also study Tae Kwon Do a bit on the side.

Latest posts by Paul Rubin (see all)