r-lib/devtools

devtools::install_github Error in function (type, msg, asError = TRUE) : <not set>

lbraglia opened this issue · 18 comments

I'm trying to install a package via devtools::install_github for the first time

l@np350v5c:~$ R --vanilla
> library(devtools)

Attaching package: ‘devtools’

The following objects are masked from ‘package:utils’:

    ?, help

The following object is masked from ‘package:base’:

    system.file

> search()
 [1] ".GlobalEnv"        "package:devtools"  "package:stats"    
 [4] "package:graphics"  "package:grDevices" "package:utils"    
 [7] "package:datasets"  "package:methods"   "Autoloads"        
[10] "package:base"

but, eg

> install_github("devtools")
Installing github repo devtools/master from hadley
Downloading master.zip from https://github.com/hadley/devtools/archive/master.zip
Errore in function (type, msg, asError = TRUE)  : <not set>

The output of traceback() is

> traceback()
12: fun(structure(list(message = msg, call = sys.call()), class = c(typeName, 
        "GenericCurlError", "error", "condition")))
11: function (type, msg, asError = TRUE) 
    {
        if (!is.character(type)) {
            i = match(type, CURLcodeValues)
            typeName = if (is.na(i)) 
                character()
            else names(CURLcodeValues)[i]
        }
        typeName = gsub("^CURLE_", "", typeName)
        fun = (if (asError) 
            stop
        else warning)
        fun(structure(list(message = msg, call = sys.call()), class = c(typeName, 
            "GenericCurlError", "error", "condition")))
    }(77L, "<not set>", TRUE)
10: .Call("R_curl_easy_perform", curl, .opts, isProtected, .encoding, 
        PACKAGE = "RCurl")
9: curlPerform(curl = handle$handle, .opts = curl_opts$values)
8: make_request("get", hu$handle, hu$url, config = config)
7: GET(url, config)
6: (function (url, name = NULL, subdir = NULL, config = list(), 
       before_install = NULL, ...) 
   {
       if (is.null(name)) {
           name <- basename(url)
       }
       message("Downloading ", name, " from ", url)
       bundle <- file.path(tempdir(), name)
       request <- GET(url, config)
       stop_for_status(request)
       writeBin(content(request), bundle)
       on.exit(unlink(bundle), add = TRUE)
       install_local_single(bundle, subdir = subdir, before_install = before_install, 
           ...)
   })(dots[[1L]][[1L]], dots[[2L]][[1L]], subdir = NULL, config = list(), 
       before_install = function (bundle, pkg_path) 
       {
           desc <- file.path(pkg_path, "DESCRIPTION")
           DESCRIPTION <- readLines(desc, warn = FALSE)
           if (any(DESCRIPTION == "")) {
               DESCRIPTION <- DESCRIPTION[DESCRIPTION != ""]
           }
           cat(DESCRIPTION, file = desc, sep = "\n")
           append_field <- function(name, value) {
               if (!is.null(value)) {
                   cat("Github", name, ":", value, "\n", sep = "", 
                     file = desc, append = TRUE)
               }
           }
           append_field("Repo", conn$repo)
           append_field("Username", conn$username)
           append_field("Ref", conn$ref)
           append_field("SHA1", github_extract_sha1(bundle))
           append_field("Pull", conn$pull)
           append_field("Subdir", conn$subdir)
           append_field("Branch", conn$branch)
           append_field("AuthUser", conn$auth_user)
       }, dependencies = TRUE)
5: mapply(install_url_single, url, name, MoreArgs = list(subdir = subdir, 
       config = config, before_install = before_install, ...))
4: install_url(conn$url, subdir = conn$subdir, config = conn$auth, 
       before_install = github_before_install, ...)
3: FUN("devtools"[[1L]], ...)
2: vapply(repo, install_github_single, FUN.VALUE = logical(1), username, 
       ref, pull, subdir, branch, auth_user, password, auth_token, 
       ..., dependencies = TRUE)
1: install_github("devtools")

I tryied with another repo but it behaves the same way.

Any hint?

Thank you,
Luca

> sessionInfo()
R version 3.1.0 (2014-04-10)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=it_IT.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=it_IT.UTF-8        LC_COLLATE=it_IT.UTF-8    
 [5] LC_MONETARY=it_IT.UTF-8    LC_MESSAGES=it_IT.UTF-8   
 [7] LC_PAPER=it_IT.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=it_IT.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] devtools_1.5

loaded via a namespace (and not attached):
[1] digest_0.6.4   evaluate_0.5.1 httr_0.2       memoise_0.1    parallel_3.1.0
[6] RCurl_1.95-4.1 stringr_0.6.2  tools_3.1.0    whisker_0.3-2 

I have exactly the same problem

!> sessionInfo()                                                                                                                                                                                                                 
 R version 3.1.0 (2014-04-10)                                                                                                                                                                                                    
 Platform: x86_64-pc-linux-gnu (64-bit)                                                                                                                                                                                          

 locale:                                                                                                                                                                                                                         
  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C                                                                                                                                                                                    
  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8                                                                                                                                                                          
  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8                                                                                                                                                                         
  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                                                                                                                                                                                       
  [9] LC_ADDRESS=C               LC_TELEPHONE=C                                                                                                                                                                                  
 [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C                                                                                                                                                                             

 attached base packages:                                                                                                                                                                                                         
 [1] stats     graphics  grDevices utils     datasets  methods   base                                                                                                                                                            

 other attached packages:                                                                                                                                                                                                        
 [1] devtools_1.5                                                                                                                                                                                                                

 loaded via a namespace (and not attached):                                                                                                                                                                                      
  [1] compiler_3.1.0 digest_0.6.4   evaluate_0.5.5 httr_0.3       memoise_0.2.1                                                                                                                                                  
  [6] parallel_3.1.0 RCurl_1.95-4.1 stringr_0.6.2  tools_3.1.0    whisker_0.3-2

Obviously I'm available for further tests, if needed.

reproduced with github's devtools version 1.5.0.99 :(

A quick'n dirty bash script in the meantime

#!/bin/bash                                                                     
# usage (eg):                                                                   
#    r_install_github devtools hadley                                           

cd /tmp && \
mkdir R_install_github  && \
cd R_install_github && \
wget https://github.com/$2/$1/archive/master.zip && \
unzip master.zip
R CMD build $1-master && \
R CMD INSTALL $1*.tar.gz && \
cd /tmp && \
rm -rf R_install_github

HTH

I have the same problem.

> sessionInfo()
R version 3.1.0 (2014-04-10)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=de_DE.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=de_DE.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=de_DE.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] devtools_1.5

loaded via a namespace (and not attached):
[1] digest_0.6.4   evaluate_0.5.5 httr_0.3       memoise_0.2.1  parallel_3.1.0 RCurl_1.95-4.1 stringr_0.6.2  tools_3.1.0    whisker_0.3-2 

Thanks @lbraglia for the script !

This looks like a problem with RCurl on linux--I get the same error with MTurkR AccountBalance()

@duncantl we summon you!

Well, unfortunately, it works for me and I cannot reproduce the problem
I'm using a version of from svn compiled at some point, but I'd be surprised if
that was in anyway related. See the sessionInfo() below.
It could well be to do with the network connection.
So I'd suggest either tracing/debugging the RCurl requests
and also enabling verbose requests, e.g. setting
options(RCurlOptions = list(verbose = TRUE))
and hoping the layers respect and use that.

sessionInfo()
R Under development (unstable) (2014-05-17 r65643)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] devtools_1.5.0.99

loaded via a namespace (and not attached):
[1] digest_0.6.4   evaluate_0.5.5 httr_0.3       memoise_0.2.1  parallel_3.2.0
[6] RCurl_1.95-4.1 stringr_0.6.2  tools_3.2.0    whisker_0.3-2

Thanks!

With verbose on, I get:

R> AccountBalance()

  • Hostname was NOT found in DNS cache
  • Trying 72.21.194.50...
  • Connected to mechanicalturk.amazonaws.com (72.21.194.50) port 443 (#7)
  • WARNING: failed to load NSS PEM library libnsspem.so. Using OpenSSL PEM certificates will not work.
  • Closing connection 7
    Error in function (type, msg, asError = TRUE) :

It appears (if indeed the missing libnsspem library is the culprit) that it is going to be some time before upstream NSS includes the pem module (apparently it needs a bit of clean up w/r/t memory, tests, etc). It's present on Fedora/RedHat, but not in any other distributions that I'm aware of.

A quick fix in the meantime should theoretically be setting ssl.verifypeer = FALSE for RCurlOptions; however that doesn't seem to make any difference.

I'll try tracing the RCurl requests.

Another option might be some means of selecting gnutls rather than nss?

Nevermind. It looks like guntls doesn't like pem cert bundles.

I updated libcurl to the latest version (available in debian testing) . Now with

ii  libcurl3:amd64                                              7.37.0-1                           amd64        easy-to-use client-side URL transfer library (OpenSSL flavour)
ii  libcurl3-gnutls:amd64                                       7.37.0-1                           amd64        easy-to-use client-side URL transfer library (GnuTLS flavour)
ii  libcurl4-openssl-dev:amd64                                  7.37.0-1                           amd64        development files and documentation for libcurl (OpenSSL flavour)

and devtools 1.5 it works fine!

@lbraglia Awesome - thanks for the debugging!

Unfortunately, I am still having problems on debian testing using

ii  libcurl3:amd64            7.37.0-1  
ii  libcurl3-gnutls:amd64     7.37.0-1
ii  libcurl3-nss:amd64        7.37.0-1
ii  libcurl4-gnutls-dev:amd64 7.37.0-1 

Using options(RCurlOptions = list(verbose = TRUE)) doesn't print anything new.

R version 3.1.0 (2014-04-10)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8       
 [4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] vimcom.plus_0.9-92 setwidth_1.0-3     colorout_1.0-2    

loaded via a namespace (and not attached):
 [1] devtools_1.5   digest_0.6.4   evaluate_0.5.5 httr_0.3       memoise_0.2.1  parallel_3.1.0
 [7] RCurl_1.95-4.1 stringr_0.6.2  tools_3.1.0    whisker_0.3-2 

@iugrina are you still having problems?

@lbraglia I've solved it by using CRAN version of RCurl (install.packages(...)) and not using r-cran-rcurl.

Hello, just for the record, this was a bug in the Debian package r-cran-rcurl that we corrected in all Debian distribution unstable, testing, and more recently stable (Jessie 8.2). Sorry for the problem, and thanks for using Debian ! The correction eventually made it in Ubuntu wily as well.

lock commented

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/