Installing "choroplethr" in Ubuntu

407 views Asked by At

I am trying to install "choroplethr."

I have read the following related-looking errors:

Their recommendation is to install something I have already installed. I have libudunits2 installed in a standard location, with:

$ sudo apt-get install libudunits2-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libudunits2-dev is already the newest version (2.2.26-1).

I can see headers:

$ ll /usr/include/ | grep unit
-rw-r--r--   1 root root  39998 Jan  5  2018 udunits2.h
-rw-r--r--   1 root root   5195 Jan  5  2018 udunits.h

However, on installation, I get this error:

$ R
R version 3.5.1 (2018-07-02) -- "Feather Spray"

> install.package("choroplethr", dep=T)
...
configure: error: in `/tmp/RtmpWC06JV/R.INSTALL7cbb4928db67/units':
configure: error: 
--------------------------------------------------------------------------------
  Configuration failed because libudunits2.so was not found. Try installing:
    * deb: libudunits2-dev (Debian, Ubuntu, ...)
    * rpm: udunits2-devel (Fedora, EPEL, ...)
    * brew: udunits (OSX)
  If udunits2 is already installed in a non-standard location, use:
    --configure-args='--with-udunits2-lib=/usr/local/lib'
  if the library was not found, and/or:
    --configure-args='--with-udunits2-include=/usr/include/udunits2'
  if the header was not found, replacing paths with appropriate values.
  You can alternatively set UDUNITS2_INCLUDE and UDUNITS2_LIBS manually.
--------------------------------------------------------------------------------

I've done these settings, but

install.packages("udunits2", configure.args = '--with-udunits2-include=/usr/include/udunits2')

-----Error: libudunits2.a not found-----
     If the udunits2 library is installed in a non-standard location,
     use --configure-args='--with-udunits2-lib=/usr/local/lib' for example,
     or --configure-args='--with-udunits2-include=/usr/include/udunits2'
     replacing paths with appropriate values for your installation.
     You can alternatively use the UDUNITS2_INCLUDE and UDUNITS2_LIB
     environment variables.
     If udunits2 is not installed, please install it.
     It is required for this package.

What am I missing? Is this package OSX only?

1

There are 1 answers

2
Ralf Stubner On BEST ANSWER

For Ubuntu with R 3.5 you can use the c2d4u3.5 PPA made available by the same persons that bring you R Ubuntu packages on CRAN, c.f. https://cran.r-project.org/bin/linux/ubuntu/README.html and http://dirk.eddelbuettel.com/blog/2017/12/22/:

sudo add-apt-repository ppa:marutter/c2d4u3.5
sudo apt-get update

After that you can install binary packages for most CRAN packages:

sudo apt-get install r-cran-choroplethr

This should work for all packages that are mentioned in CRAN task views.

Besides this, I tried to reproduce your installation problems using docker:

FROM ubuntu:18.04
ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update \
 && apt-get install --yes --no-install-recommends gnupg ca-certificates \
 && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9 \
 && echo "deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/" >> /etc/apt/sources.list \
 && apt-get update \
 && apt-get install  --yes --no-install-recommends r-base-dev libudunits2-dev \
 && Rscript -e 'install.packages(c("units", "udunits2"))'

However, the image was build without problems.