r-quantities/units

units not working due to missing udunits C libraries

dantonnoriega opened this issue · 45 comments

The package units depends on the packages udunits2. However, while the udunits2 package seems to successfully install after running install.packages('udunits2'), it doesn't actually work out-of-the-box. You can see this when you try to install it from from source.

I received the following error when I tried to install udunits2 from source...

> install.packages('udunits2', type = 'source')

[OMITTED]

-----Error: libudunits2 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.
ERROR: configuration failed for package ‘udunits2’
-----Error: libudunits2 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.
ERROR: configuration failed for package ‘udunits2’

Hence, what we need are these libraries.

Here is how I solved it on my mac using Homebrew.

  1. In your Terminal.app, do the following:
brew install udunits

While I used Homebrew, it appears you can download the libraries here. I did not do it this way, but I'm assuming that if you do this successfully, then you should be able to do steps 2 and 3.

  1. Once installed, go to R and install udunits2 from source...
install.packages('udunits2', type = 'source', repo = 'cran.rstudio.com')
  1. Install units (I installed the development version).
devtools::install_github('edzer/units', type = 'source')

Or

install.packages('units', type = 'source')

DONE

it doesn't actually work out-of-the-box

To be fair, the udunits2 R package does specifically declare a SystemRequirements which, by definition, has to be dealt with outside of the R packaging environment.

edzer commented

The problem is that this is left to the user, and many R users don't know what to do. Add a README.md to the Rudunits2 project, link from here? Where can windows binaries of udunits be found?

It may be just easiest to bundle libudunits2 with the udunits2 package. The rwinlib project offers quite a few libraries bundled for Windows, but I haven't found udunits2 there -- CC @gaborcsardi @jeroenooms.

Why would windows users need to install from source? install.packages('udunits2') does work out of the box?

Oh, it does on my system, too. @ultinomics mentioned that "t doesn't actually work out-of-the-box"...

I have added windows builds on rwinlib/udunits and also created a PR on the R package which automatically uses these builds when building the package from source on Windows: pacificclimate/Rudunits2#7

edzer commented

This is because on windows CRAN packages, external dependencies (SysRequirements) are linked statically to the shared library in the package. It seems this is also the case on mac -- @ultinomics installed from source. Thanks for the pointer to rwinlib!

just for the record, on mac and to complete the nice @ultinomics's answer
after installing udunits withbrew install udunits, I needed this to successfully compile:

install.packages('udunits2', type = 'source', repo = 'cran.rstudio.com', configure.args = "--with-udunits2-lib=/usr/local/Cellar/udunits/2.2.20/lib/")

Is there a prospect for a near-term resolution of this? I'd like to add to my package a dependency on ggforce, which depends on units 0.4, but then the udunits issue breaks my travis builds.

edzer commented

Not sure if I understand your issue: have you seen this? Or are you trying a MacOSX flavor of travis?

Yes, and both osx and linux.

Compare this: https://travis-ci.org/elbamos/largeVis/jobs/183274802 (OSX build works), with this https://travis-ci.org/elbamos/largeVis/jobs/183274804 (everything identical but using R-devel, build fails).

(A similar issue may be arising with Ubuntu and 64-bit builds, but I'm not yet sufficiently confident in the issue to report it. I'll know tonight.)

edzer commented

Well, it's your call that you want to do a macosx travis for r-devel, for which cran does not have binaries available: it means that you'll have to install udunits2 for this platform from source too. Although that is no problem at all in itself, IMHO you're overdoing your eagerness to check everything you can with this target: is it worth the effort?

edzer commented

No, CRAN requires you test with r-devel, it doesn't specify on which platform. CRAN binary packages for MacOSX come with statically linked libraries, meaning the udunits2 C library is part of the udunits2 R package, and ignored by the R package. I don't think that your first travis build mentioned above installs source packages: extension .tgz indicates binary MacOSX packages, source pkgs have .tar.gz extension.

There are no CRAN binary package for r-devel so on these targets you need to build from source and hence need to ensure that the system dependencies are available. Just add a line:

brew_packages: udunits

to the osx/r-devel entry in your travis build matrix.

edzer commented

The error messages you see on the travis output, as well as the message in this issue just above your first one here are all pretty full with instructions on how to solve this. Also, your issue is really with udunits2, not with this package.

I'm trying to install this package and am it's failing, telling me udunits2.h not found despite it actually being there. Do you have a dependency on that specific version of udunits2?

checking for unistd.h... yes
checking udunits2.h usability... no
checking udunits2.h presence... no
checking for udunits2.h... no
checking for ut_read_xml in -ludunits2... yes
-----Error: udunits2.h 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.

I tried to install it with:

install.packages("units", 
                  configure.args = c("--with-udunits2-include=/usr/include/udunits2", 
                                     "--with-udunits2-lib=/usr/lib64"), 
                  type = "source")

Although, I also set the suggested UDUNITS2_INCLUDE, UDUNITS2_LIB, and UDUNITS2_XML_PATH environment variables as well, just in case.

I installed the udunits2 development RPM package on CentOS6.6. It is version 2.1.19.

edzer commented

Package units doesn't need udunits2.h, so I think that your problem is with installing udunits2, rather than with units, am I right? See here for a place to raise issues on that.

Thanks, Edzer. Applying the same configure.args to that package let me install.

I just spent half a day on this! Thanks @ginolhac for the solution. It would be nice to see this somewhere on the sfr package README after brew install udunits.

ggforce is also one of my dependencies and I met with the same problem, solved by adding one line in .travis.yml file

apt_packages: libudunits2-dev

the same issue has also been discussed here

For those users who are working on a cluster and don't have root access, the following worked for me. Hope it helps someone! From within R:

homedir <- Sys.getenv("HOME")
udunits_dir <- file.path(Sys.getenv("HOME"), "udunits")
system(paste0("mkdir ", udunits_dir))
system(paste0("wget --directory-prefix=", udunits_dir, " ftp://ftp.unidata.ucar.edu/pub/udunits/udunits-2.2.26.tar.gz"))
owd <- getwd()
setwd(udunits_dir)
system("tar xzvf udunits-2.2.26.tar.gz")
setwd(file.path(udunits_dir, "udunits-2.2.26"))
system(paste0("./configure --prefix=", udunits_dir, "/local"))
system("make")
system("make install")
setwd(owd)
Sys.setenv(LD_LIBRARY_PATH=paste0(Sys.getenv("LD_LIBRARY_PATH"), ":", udunits_dir, "/local/lib"))
install.packages("udunits2", 
                 type = "source",
                 configure.args = c(paste0("--with-udunits2-include=", udunits_dir, "/local/include"), 
                                    paste0("--with-udunits2-lib=", udunits_dir, "/local/lib")),
                 repos = "http://cran.rstudio.com")
dyn.load(paste0(udunits_dir, "/local/lib/libudunits2.so.0"))
devtools::install_github("r-quantities/units", 
                         args=paste0("--configure-args=\"--with-udunits2-lib=", udunits_dir, 
                                     "/local/lib --with-udunits2-include=", udunits_dir, "/local/include\""))

You will then need to add:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH":"$HOME"/udunits/local/lib"

to your .bashrc.

Thank you for your solution. It worked and I was able to install "udunits2", and "units". However, as you do not mention "ClassInt", installing it, is throwing an error.I have Xcode installed on my mac. Thank you.

`> install.packages('classInt', type = 'source')
trying URL 'https://cran.rstudio.com/src/contrib/classInt_0.1-24.tar.gz'
Content type 'application/x-gzip' length 19194 bytes (18 KB)
==================================================
downloaded 18 KB

* installing *source* package ‘classInt’ ...
** package ‘classInt’ successfully unpacked and MD5 sums checked
** libs
/Users/sherrymukim/anaconda3/bin/x86_64-apple-darwin13.4.0-gfortran   -fPIC  -march=nocona -mtune=core2 -ftree-vectorize -fPIC -fstack-protector -O2 -pipe -I/Users/sherrymukim/anaconda3/include -L/Users/sherrymukim/anaconda3/lib  -c fish1.f -o fish1.o
make: /Users/sherrymukim/anaconda3/bin/x86_64-apple-darwin13.4.0-gfortran: No such file or directory
make: *** [fish1.o] Error 1
ERROR: compilation failed for package ‘classInt’
* removing ‘/Users/sherrymukim/anaconda3/lib/R/library/classInt’
Warning in install.packages :
  installation of package ‘classInt’ had non-zero exit status

The downloaded source packages are in
	‘/private/var/folders/p9/6qp4xp2536jdmxd8qkzkhp7m0000gn/T/RtmpENRNpn/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done`

@sagar-m This has nothing to do with units and @rsbivand has kindly provided in r-spatial/sf#680 several solutions several times already.

@sagar-m you should be using the recommended R for mac. If you really want to use anaconda you better ask your question over there, this is a problem with their setup.

@jeroen that was an excellent suggestion. I do have R for mac, but because I use Anaconda for spyder (python), and they have R studio, thus I was using it. I was able to download sf (binary), and "ClassInt" (source) using R for mac. Thank you very much.

elinw commented

Wanted to mention that on CentOS after doing the yum install
install.packages("udunits2",configure.args='--with-udunits2-include=/usr/include/udunits2')

Seems to have worked.

I followed instructions of @dantonnoriega (thanks!) and I seem to have succesfully installed units and udunits2 but when I try to use st_distance / st_area I continue to get the same error. (I am working with R.3.3 on a mac)
Error: In ‘udunits_from_proj[x$units]’, ‘udunits_from_proj’ and ‘x’ are not recognized by udunits.
See a table of valid unit symbols and names with valid_udunits().
Add custom user-defined units with install_symbolic_unit().

Any suggestions on this specific error?

edzer commented

Could you give the output of sessionInfo()?

Sure!

sessionInfo()
R version 3.3.3 (2017-03-06)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: macOS 10.13.3

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] bindrcpp_0.2 sf_0.5-5 dplyr_0.7.4 units_0.5-1 udunits2_0.13 sp_1.2-7

loaded via a namespace (and not attached):
[1] Rcpp_0.12.16 knitr_1.19 bindr_0.1 magrittr_1.5 munsell_0.4.3 colorspace_1.3-2
[7] lattice_0.20-35 R6_2.2.2 rlang_0.2.0.9001 plyr_1.8.4 tools_3.3.3 grid_3.3.3
[13] gtable_0.2.0 e1071_1.6-8 DBI_0.7 class_7.3-14 lazyeval_0.2.1 assertthat_0.2.0
[19] tibble_1.4.2 ggplot2_2.2.1.9000 glue_1.2.0 pillar_1.1.0 scales_0.5.0.9000 classInt_0.1-24
[25] pkgconfig_2.0.1

edzer commented

Please update to the latest sf version, and retry.

Thanks, it took a bit but it worked (YAY!).

Here's the trick:
My first attempt to update sf failed because of this (same error trying to update rgdal):

configure: error: gdal-config not found or not executable.
ERROR: configuration failed for package ‘sf’

Then I followed this suggestion and did (https://stackoverflow.com/questions/34333624/trouble-installing-rgdal/37829420)
- in Terminal:
brew update
brew install gdal

- in R:
install.packages("rgdal")
install.packages("sf")

and I was able to update both sf and rgdal. Now geoprocessing functions are working.

Hi, following instructions above in this thread I was able to install udunits2 and udunits2 R package, but not units package.
With:
install.packages("udunits2", configure.args = "--with-udunits2-lib=/path/to/udunits2/lib --with-udunits2-include=/path/to/udunits2/include")

it works, I got:

checking for unistd.h... yes
checking udunits2.h usability... yes
checking udunits2.h presence... yes
checking for udunits2.h... yes
checking for ut_read_xml in -ludunits2... yes

and the package gets correctly installed.

But the exact same line with the units package instead of the udunits2 will still get me a udunits2 error:

install.packages("units", configure.args = "--with-udunits2-lib=/path/to/udunits2/lib --with-udunits2-include=/path/to/udunits2/include")

checking for _Bool... no
checking for error_at_line... yes
checking for gcc... gcc -std=gnu99
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ISO C89... none needed
checking for XML_ParserCreate in -lexpat... yes
checking udunits2.h usability... no
checking udunits2.h presence... no
checking for udunits2.h... no
checking udunits2/udunits2.h usability... no
checking udunits2/udunits2.h presence... no
checking for udunits2/udunits2.h... no
checking for ut_read_xml in -ludunits2... yes
configure: error: in /tmp/Rtmpy6pWQc/R.INSTALL227932752505/units:
configure: error:
--------------------------------------------------------------------------------
  udunits2.h not found!

  If the udunits2 library is installed in a non-standard location, use:

    --configure-args='--with-udunits2-lib=/usr/local/lib'

  for example, 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 for your
  installation. You can alternatively use the UDUNITS2_INCLUDE and UDUNITS2_LIBS
  environment variables.

  If udunits2 is not installed, please install it.
  It is required for this package.

I cannot understand why it does not work with units, the files are present and the paths are correct, otherwise udunit2 R package would not get installed each time I try...

Can you give us more details?

  • Does install.packages("units") work, without configure.args?
  • Where is your udunits2 library installed?
edzer commented

Thanks, I could reproduce this. With the fix on github, you can install with

> devtools::install_github("r-quantities/units", args='--configure-args="--with-udunits2-lib=/opt/lib --with-udunits2-include=/opt/include"')

Thanks a lot, it worked!

Just out of curiosity, what was the problem?

edzer commented

this line was missing, so although you'd set the include dir, the test wouldn't use it.

@edzer when version containing this fix will be deployed on CRAN?

edzer commented

I hope within a month.

@edzer I'm still having troubles even with the dev package, any idea on how to fix this?
Thanks!

> devtools::install_github("r-quantities/units", args='--configure-args="--with-udunits2-lib=/usr/prog/ati/lib --with-udunits2-include=/usr/prog/ati/include"')
Downloading GitHub repo r-quantities/units@master
from URL https://api.github.com/repos/r-quantities/units/zipball/master
Installing units
'/usr/prog/R/3.5.0-goolf-1.5.14-NX/lib64/R/bin/R' --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL  \
  '/tmp/Rtmpd02LWv/devtools1448c1e42389b/r-quantities-units-29ffac2' --library='/home/ferreen2/R/x86_64-pc-linux-gnu-library/3.5' --install-tests  \
  --configure-args="--with-udunits2-lib=/usr/prog/ati/lib --with-udunits2-include=/usr/prog/ati/include" 

* installing *source* package ‘units’ ...
configure: units: 0.6-1
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C++ preprocessor... g++ -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for stdbool.h that conforms to C99... yes
checking for _Bool... no
checking for error_at_line... yes
checking for gcc... gcc -std=gnu99
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ISO C89... none needed
checking for XML_ParserCreate in -lexpat... yes
checking udunits2.h usability... yes
checking udunits2.h presence... yes
checking for udunits2.h... yes
checking for ut_read_xml in -ludunits2... yes
configure: creating ./config.status
config.status: creating src/Makevars
** libs
g++  -I"/usr/prog/R/3.5.0-goolf-1.5.14-NX/lib64/R/include" -DNDEBUG -I/usr/prog/ati/include -I/usr/prog/ati/include -I/usr/prog/OpenBLAS/0.2.8-gompi-1.5.14-NX-LAPACK-3.5.0/include -I/usr/prog/ScaLAPACK/2.0.2-gompi-1.5.14-NX-OpenBLAS-0.2.8-LAPACK-3.5.0/include -I/usr/prog/FFTW/3.3.4-gompi-1.5.14-NX/include -I/usr/prog/java/1.8.0_20/include -I/usr/prog/bzip2/1.0.6-goolf-1.5.14-NX/include -I/usr/prog/xz/5.2.2-goolf-1.5.14-NX/include -I/usr/prog/pcre/8.37-goolf-1.5.14-NX/include -I/usr/prog/curl/7.49.1-goolf-1.5.14-NX/include -I/usr/prog/zlib/1.2.8-goolf-1.5.14-NX/include -I"/home/ferreen2/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -I/usr/prog/OpenBLAS/0.2.8-gompi-1.5.14-NX-LAPACK-3.5.0/include -I/usr/prog/ScaLAPACK/2.0.2-gompi-1.5.14-NX-OpenBLAS-0.2.8-LAPACK-3.5.0/include -I/usr/prog/FFTW/3.3.4-gompi-1.5.14-NX/include -I/usr/prog/java/1.8.0_20/include -I/usr/prog/bzip2/1.0.6-goolf-1.5.14-NX/include -I/usr/prog/xz/5.2.2-goolf-1.5.14-NX/include -I/usr/prog/pcre/8.37-goolf-1.5.14-NX/inc... <truncated>
gcc -std=gnu99 -I"/usr/prog/R/3.5.0-goolf-1.5.14-NX/lib64/R/include" -DNDEBUG -I/usr/prog/ati/include -I/usr/prog/ati/include -I/usr/prog/OpenBLAS/0.2.8-gompi-1.5.14-NX-LAPACK-3.5.0/include -I/usr/prog/ScaLAPACK/2.0.2-gompi-1.5.14-NX-OpenBLAS-0.2.8-LAPACK-3.5.0/include -I/usr/prog/FFTW/3.3.4-gompi-1.5.14-NX/include -I/usr/prog/java/1.8.0_20/include -I/usr/prog/bzip2/1.0.6-goolf-1.5.14-NX/include -I/usr/prog/xz/5.2.2-goolf-1.5.14-NX/include -I/usr/prog/pcre/8.37-goolf-1.5.14-NX/include -I/usr/prog/curl/7.49.1-goolf-1.5.14-NX/include -I/usr/prog/zlib/1.2.8-goolf-1.5.14-NX/include -I"/home/ferreen2/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -I/usr/prog/OpenBLAS/0.2.8-gompi-1.5.14-NX-LAPACK-3.5.0/include -I/usr/prog/ScaLAPACK/2.0.2-gompi-1.5.14-NX-OpenBLAS-0.2.8-LAPACK-3.5.0/include -I/usr/prog/FFTW/3.3.4-gompi-1.5.14-NX/include -I/usr/prog/java/1.8.0_20/include -I/usr/prog/bzip2/1.0.6-goolf-1.5.14-NX/include -I/usr/prog/xz/5.2.2-goolf-1.5.14-NX/include -I/usr/prog/pcre/8.37-goolf-1.5... <truncated>
g++  -I"/usr/prog/R/3.5.0-goolf-1.5.14-NX/lib64/R/include" -DNDEBUG -I/usr/prog/ati/include -I/usr/prog/ati/include -I/usr/prog/OpenBLAS/0.2.8-gompi-1.5.14-NX-LAPACK-3.5.0/include -I/usr/prog/ScaLAPACK/2.0.2-gompi-1.5.14-NX-OpenBLAS-0.2.8-LAPACK-3.5.0/include -I/usr/prog/FFTW/3.3.4-gompi-1.5.14-NX/include -I/usr/prog/java/1.8.0_20/include -I/usr/prog/bzip2/1.0.6-goolf-1.5.14-NX/include -I/usr/prog/xz/5.2.2-goolf-1.5.14-NX/include -I/usr/prog/pcre/8.37-goolf-1.5.14-NX/include -I/usr/prog/curl/7.49.1-goolf-1.5.14-NX/include -I/usr/prog/zlib/1.2.8-goolf-1.5.14-NX/include -I"/home/ferreen2/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -I/usr/prog/OpenBLAS/0.2.8-gompi-1.5.14-NX-LAPACK-3.5.0/include -I/usr/prog/ScaLAPACK/2.0.2-gompi-1.5.14-NX-OpenBLAS-0.2.8-LAPACK-3.5.0/include -I/usr/prog/FFTW/3.3.4-gompi-1.5.14-NX/include -I/usr/prog/java/1.8.0_20/include -I/usr/prog/bzip2/1.0.6-goolf-1.5.14-NX/include -I/usr/prog/xz/5.2.2-goolf-1.5.14-NX/include -I/usr/prog/pcre/8.37-goolf-1.5.14-NX/inc... <truncated>
g++ -shared -L/usr/prog/R/3.5.0-goolf-1.5.14-NX/lib64/R/lib -L/usr/prog/GCC/4.8.2/lib64 -L/usr/prog/GCC/4.8.2/lib -L/usr/prog/OpenBLAS/0.2.8-gompi-1.5.14-NX-LAPACK-3.5.0/lib -L/usr/prog/ScaLAPACK/2.0.2-gompi-1.5.14-NX-OpenBLAS-0.2.8-LAPACK-3.5.0/lib -L/usr/prog/FFTW/3.3.4-gompi-1.5.14-NX/lib -L/usr/prog/java/1.8.0_20/lib -L/usr/prog/bzip2/1.0.6-goolf-1.5.14-NX/lib -L/usr/prog/xz/5.2.2-goolf-1.5.14-NX/lib -L/usr/prog/pcre/8.37-goolf-1.5.14-NX/lib -L/usr/prog/curl/7.49.1-goolf-1.5.14-NX/lib -L/usr/prog/zlib/1.2.8-goolf-1.5.14-NX/lib -o units.so RcppExports.o io.o udunits.o -lexpat -L/usr/prog/ati/lib -lexpat -ludunits2 -L/usr/prog/R/3.5.0-goolf-1.5.14-NX/lib64/R/lib -lR
installing to /home/ferreen2/R/x86_64-pc-linux-gnu-library/3.5/units/libs
** R
** demo
** inst
** tests
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
Error: package or namespace load failed for ‘units’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/home/ferreen2/R/x86_64-pc-linux-gnu-library/3.5/units/libs/units.so':
  libudunits2.so.0: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/ferreen2/R/x86_64-pc-linux-gnu-library/3.5/units’
Error: Command failed (1)
edzer commented

This has nothing to do with the units package, but with you wanting to load dynamically linked libraries from a custom path without telling your system. Read into setting the environment variable LD_LIBRARY_PATH, or motify /etc/ld.so.conf and using ldconfig. In this case, starting R with

LD_LIBRARY_PATH=/usr/prog/ati/lib R

may work.

Ah, yes, thank you!
LD_LIBRARY_PATH=/usr/prog/ati/lib:$LD_LIBRARY_PATH R
followed by
devtools::install_github("r-quantities/units", args='--configure-args="--with-udunits2-lib=/usr/prog/ati/lib --with-udunits2-include=/usr/prog/ati/include"')
worked.

duoan commented

install.packages("rgeos", repos="http://R-Forge.R-project.org", type="source", configure.args='/usr/local/Cellar/geos/3.7.0/bin/geos-config')

@classtag : what does this have to do with anything? The units package does not depend on rgeos in any way. For R-spatial packages in general write to R-sig-geo after subscribing. A guess is that you are misusing configure.args which should include the argument:

'--with-geos-config=<path to geos-config>'