Can't install devtools in RStudio -- Dependencies not found (xml2/rversions)

6k views Asked by At

I'm new to R and RStudio but trying to learn and put together a ShinyApps app. I cannot get past Step 1 of the Shinyapps process, which is to install the devtools package in RStudio. I believe the underlying cause is that the "xml2" package dependency is not installed, but I can't seem to resolve that and I don't understand what to do.

I'm on Linux Mint Cinnamon 17.1 on a Dell laptop. I installed RStudio from the Software Manager. In trying to resolve the errors during devtools installation, I've tried installing R and RStudio from slightly newer package downloads using apt-get, I've tried installing xml2 and rversions from RStudio (not available), I've tried using single quotes and double quotes, I've tried adding dependency=true to all RStudio installation attempts, I've restarted both RStudio and the machine numerous times... I'm out of ideas... help?

Following is the output from the devtools installation command inside RStudio, plus the output of "version" in case it helps.

install.packages("devtools")
Installing package into ‘/home/[MyHomeDir]>/R/i686-pc-linux-gnu-library/3.0’
(as ‘lib’ is unspecified)
Warning in install.packages :
  dependency ‘xml2’ is not available
also installing the dependency ‘rversions’

trying URL 'http://cran.rstudio.com/src/contrib/rversions_1.0.1.tar.gz'
Content type 'application/x-gzip' length 4624 bytes
opened URL
==================================================
downloaded 4624 bytes

trying URL 'http://cran.rstudio.com/src/contrib/devtools_1.8.0.tar.gz'
Content type 'application/x-gzip' length 141487 bytes (138 Kb)
opened URL
==================================================
downloaded 138 Kb

ERROR: dependency ‘xml2’ is not available for package ‘rversions’
* removing ‘/home/[MyHomeDir]/R/i686-pc-linux-gnu-library/3.0/rversions’
Warning in install.packages :
  installation of package ‘rversions’ had non-zero exit status
ERROR: dependency ‘rversions’ is not available for package ‘devtools’
* removing ‘/home/[MyHomeDir]/R/i686-pc-linux-gnu-library/3.0/devtools’
Warning in install.packages :
  installation of package ‘devtools’ had non-zero exit status

The downloaded source packages are in
        ‘/tmp/RtmpNJIGkV/downloaded_packages’

version
               _                           
platform       i686-pc-linux-gnu           
arch           i686                        
os             linux-gnu                   
system         i686, linux-gnu             
status                                     
major          3                           
minor          0.2                         
year           2013                        
month          09                          
day            25                          
svn rev        63987                       
language       R                           
version.string R version 3.0.2 (2013-09-25)
nickname       [nickname redacted]            
2

There are 2 answers

0
JakeC On

Update to the newest version of R then follow the instructions provided in the link and you should be able to get it installed.

https://github.com/hadley/devtools

2
Willem Bressers On

I had an old R version (3.0.2) running on Ubuntu 14.04. And this is how i had to update R:

  • open the sources list sudo vi /etc/apt/sources.list
  • Add a cran mirror (i.e. deb http://cran.rstudio.com/bin/linux/ubuntu trusty/)
  • Add an APT-key sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9 (see cran)
  • Now update R sudo apt-get install r-base

Now i was able to install devtools. In my case ALL, installed packaged where updated, so this could take some time.