Hi Dchiu
i followed the steps to install xml2 package but still getting the below 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=...'
First, it's best practice to reproduce your error with as a reprex (If you're not familiar with that; REPRoducible EXample (reprex)).
Second, your error message provides advice to resolve the issue. What happens after you follow that lead?
Specifically, the message:
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=...'
Next, if the issue presists,
Some system Information could be useful as well
#### System Information:
- RStudio Edition: (Desktop or Server)
- RStudio Version:
- OS Version:
- R Version:
#### Also:
<!-- Depending on your issue, the following may be useful /-->
<!-- If a section isn't relevant or you can't collect it just delete that section below /-->
- RStudio diagnostics report: <!--see rstd.io/support-diagnostics-report /-->
- Your `sessionInfo()`:
- RStudio crash report: <!-- rstd.io/support-crash-report /-->
- RStudio application log files: <!-- rstd.io/support-ide-log-files /-->
The answer is actually in the error! You need to install libxml2-dev (or devel, etc.) on your machine outside of R. For example, I ran into this problem on my mac, and used homebrew from the command line to:
brew install libxml2
The R package xml2 cannot be setup without libxml2-dev!
Is it the dev version of libxml2? If not, you do need the dev version. If it is the dev version, then proceed to the second part of the error message
#> 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=...'