Skip to content

units not working due to missing udunits C libraries #1

@dantonnoriega

Description

@dantonnoriega

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions