0

I'm trying to tie R to Twitter and everything I try has been failing. I've been looking at several links including the following: One, Two, Three

While those have led to more issues, I'm now looking at the links here and here to try some workarounds. I would have posted my question as a comment to either of these links but I don't have enough rep yet.

When I run the following code, I get the following error

Code:

library(base64enc)
library(RCurl)
library(httr)
set_config( config( ssl_verifypeer = 0L ) )
devtools::install_github("jrowen/twitteR", user="MY_USERNAME", password="MY_PASSWORD", ref = "oauth_httr_1_0")

Error:

WARNING: Rtools is required to build R packages, but is not currently installed.
Please download and install Rtools 3.3 from http://cran.r-project.org/bin/windows/Rtools/ and then run find_rtools().
Downloading GitHub repo jrowen/twitteR@oauth_httr_1_0
Error in download(dest, src, auth) : client error: (401) Unauthorized

Am I just completely missing something here in how to download this dev twitteR package? Does anyone have an idea on how to get past the 401 error?

Thanks,

Community
  • 1
  • 1
JRW
  • 43
  • 5
  • 1
    Did you install Rtools? – romants Nov 16 '15 at 18:30
  • Didn't think it was needed since I'm not building packages. I will attempt with it. – JRW Nov 16 '15 at 18:45
  • Even after installing Rtools and restarting R, I get the same error. As described below, when I leave off the `set_config( config( ssl_verifypeer = 0L ) )` I get an error of `Downloading GitHub repo jrowen/twitteR@oauth_httr_1_0 Error in curl::curl_fetch_memory(url, handle = handle) : Peer certificate cannot be authenticated with given CA certificates` – JRW Nov 16 '15 at 19:01
  • @JRW there is a difference between **building** and **developing** packages. Building means compiling code. You need this to install any package that has compiled code. One thing to be aware of when installing Rtools is to [fix your path](https://stevemosher.wordpress.com/step-six-fixing-your-path/). – alexwhitworth Nov 16 '15 at 20:02

1 Answers1

0

Have you installed and sourced R tools in the session you are referencing above? You aren't getting a certificate error (were you before?) which suggests you don't have a certificate server you're running under as was the issue in some of your linked posts.

I would suggest the following steps to find your issue.

You may need the httpuv package which can be downloaded sourced with

install.packages('httpuv')
library('httpuv')

Sometimes the twitteR package needs an older version of httr to work correctly, depending on jrowen's (and hadley's) updates.

You may try installing the older version of httr

 devtools::install_version("httr", version="0.6.0", repos="http://cran.us.r-project.org")

and restarting R and then trying your install again. Note that if you are on a 64-bit machine, you will probably have to install the most recent version of httr first, then install the older version.

Zediiiii
  • 750
  • 1
  • 7
  • 21
  • I will install and source Rtools and try that. As I mentioned to @Roman, I didn't think it'd be needed since I'm not actually building packages. I've gotten every certificate and authentication error that users in my posted links have ran into. Also, I tried to install the older httr using the code you provided and I'm also getting a `Error in download(bundle, x$url, x$config) : client error: (401) Unauthorized` error just with this. – JRW Nov 16 '15 at 18:50
  • Now with leaving out the `set_config( config( ssl_verifypeer = 0L ) )` piece and trying your install of httr after installing Rtools, I'm getting an error of `Downloading package from url: http://cran.us.r-project.org/src/contrib/Archive/httr/httr_0.6.0.tar.gz Error in curl::curl_fetch_memory(url, handle = handle) : Peer certificate cannot be authenticated with given CA certificates`. Leaving that piece off as well takes me back to an error of `Error in curl::curl_fetch_memory(url, handle = handle) : Peer certificate cannot be authenticated with given CA certificates` in twitteR install – JRW Nov 16 '15 at 18:56