I launched R in my command-line and typed the following:
install.packages(\"XML\")
After selecting a mirror site, I saw the following outpu
Solution for Mac OS Catalina (i.e. in zsh).
I'm a novice, but this worked for me.
Make sure you have libxml2 installed in homebrew. (If you got it, brew list | grep libxml2
should confirm it; otherwise install it brew install libxml2
. Don't have homebrew? Install it.)
Either create a zsh run com, touch ~/.zshrc
, or find it in your home directory cd ~
. (Use ls -a
in Terminal to see if its in ~
.)
Then make sure: export PATH="/usr/local/opt/libxml2/bin:$PATH"
is in there (i.e. in ~/.zshrc
). It shouldn't be in there yet! Add it using sudo nano ~/.zshrc
. Then save it (ctrl + x, Y, enter). This should make sure the path to brew's libxml2 is the first thing that comes up when looking for libxml2. (FYI, I also added it to ~/.zprofile
. I don't know which one is correct.)
Ok, now restart your terminal. Then run R in the Terminal using R
. Once R has started, install.packages("XML")
, pick a server to download it, and you should be good to go.
adding to @Travis's answer using conda install -c r r-xml=3.98_1.5
or conda install -c conda-forge r-xml
works.
But make sure to run conda update r-essentials
and reopen/restart the r terminal\notebook
(whichever is your case).
You explained what is wrong and that helps.
XML package documentation in here: https://cran.r-project.org/web/packages/XML/index.html
Pay attetion to where it says You are trying to use a version 2.* edition of libxml
but an incompatible library.
What system are you using? I use OSX and when I had a similar issue I did run
brew install libxml2
and then it worked
I also see you use R 3.0+ and that should be very compatible.
I solved this problem by using anaconda to install XML:
conda install -c r r-xml=3.98_1.5