0

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?

timcdlucas
  • 1,334
  • 8
  • 20

2 Answers2

5

My best guess -- you have something in your ~/.Rprofile that's attempting to load httr (or a package that uses httr) -- since surely, nothing in base R relies on httr.

I believe install.packages() launches an R sub-process (using the same arguments on load as the current session), which in turn will source that ~/.Rprofile, and cause the errors you are seeing.

If I am correct, one solution would be to move / comment out your ~/.Rprofile and restore it after re-installing httr. Alternatively, launching R with the --vanilla flag (to suppress any site / profile loading) should also help in alleviating the problem.

Kevin Ushey
  • 20,530
  • 5
  • 56
  • 88
  • Yes I had devtools in my Rprofile. As mentioned above, running in vanilla fixed the problem, so I can't now test whether this works. – timcdlucas Mar 02 '15 at 16:44
1

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.

timcdlucas
  • 1,334
  • 8
  • 20