Installing R dependencies in Linux Mint

install.packages('xml2')

For example, if I try to install the above package, I get this error message:

------------------------- ANTICONF ERROR ---------------------------
Configuration failed because libxml-2.0 was not found. Try installing:
 * deb: libxml2-dev (Debian, Ubuntu, etc)
 * rpm: libxml2-devel (Fedora, CentOS, RHEL)
 * csw: libxml2_dev (Solaris)
If libxml-2.0 is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a libxml-2.0.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=...'
--------------------------------------------------------------------

I think I need to fix the path. How do I do that? I have the latest version of Linux Mint.

Upvotes: 1

Views: 800

Answers (1)

Dirk is no longer here
Dirk is no longer here

Reputation: 368261

You have two basic choices:

First, you follow the advice of the error message you quoted and do

sudo apt install libxml2-dev

as your distribution is in fact a Debian/Ubuntu derivative.

Second, you could just install the existing binary from the distro

sudo apt install r-cran-xml2

Also, the r-sig-debian list is a good place to lurk and learn and ask questions.

Upvotes: 2

Related Questions