Search code examples
rdevtoolshttr

Deleted httr, now can't reinstall, or load devtools


I was trying to install twitteR, but the install failed, saying I needed httr >0.6 and I only had 0.3.

I tried to update httr. However, I seemed to have to 2 versions simultaneously, and when I used library(twitteR) it still said I had httr 0.3 and needed 0.6 (sorry I don't have the exact error messages anymore, and can't replicate due to the problems below.)

So, I deleted httr with remove.packages('httr') (this was a mistake).

Now I cannot load devtools

> library(devtools)
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : 
  there is no package called ‘httr’
Error: package or namespace load failed for ‘devtools’

or install packages

install.packages('httr')

'''Some lines skipped'''

Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : 
  there is no package called ‘httr’
Error: package or namespace load failed for ‘devtools’
Execution halted

I get the same error message as above when trying to install httr from a tarball with R CMD INSTALL.

I'm pretty stuck. Is it time for a clean R install?

And for future reference, how do I update httr?


Solution

  • Running R as R --vanilla fixed the problem.

    I could then install httr with

    install.packages('httr')
    

    And then loading devtools works and installing twitteR then works as well.