Skip to content

renv::install fails with nested github repository #497

Closed

Description

@DanOvando

renv has been a huge help in managing my package dependencies, thanks! Running into a small issue. renv ususally works great installing development versions of packages from github. However, it seems to fail when the packages itself is in a nested folder on github. installing the TMBhelper package (only available on github) running remotes::install_github("kaskr/TMB_contrib_R/TMBhelper") works normally (TMBhelper lives in a nested folder of repoistory TMB_contrib_R). But, running the same command with renv::install fails

library(remotes)
# install using remotes
remotes::install_github("kaskr/TMB_contrib_R/TMBhelper")
#> Downloading GitHub repo kaskr/TMB_contrib_R@HEAD
#> Running `R CMD build`...
#> * checking for file ‘/private/var/folders/vt/975_52y17cv36nvw83_dcslw0000gn/T/RtmpF4txW9/remotes984c23d40f7e/kaskr-TMB_contrib_R-8cb8bbf/TMBhelper/DESCRIPTION’ ... OK
#> * preparing ‘TMBhelper’:
#> * checking DESCRIPTION meta-information ... OK
#> * checking for LF line-endings in source and make files and shell scripts
#> * checking for empty or unneeded directories
#> * building ‘TMBhelper_1.2.0.tar.gz’
#> Installing package into '/Users/danovan/projects/renvtest/renv/library/R-4.0/x86_64-apple-darwin17.0'
#> (as 'lib' is unspecified)
#install using renv
renv::install("kaskr/TMB_contrib_R/TMBhelper")
#> Warning: curl: (22) The requested URL returned error: 404 Not Found

#> Warning: curl: (22) The requested URL returned error: 404 Not Found
#> Error: failed to parse remote 'kaskr/TMB_contrib_R/TMBhelper' -- download failed [error code 22]

Created on 2020-07-27 by the reprex package (v0.3.0)

Activity

  1. kevinushey commented on Jul 28, 2020

    @kevinushey
    Collaborator

    The problem here is that renv uses a slightly different syntax for packages in sub-directories of projects -- in particular, it uses : as a delimiter. For example, the following should work:

    > renv::install("kaskr/TMB_contrib_R:TMBhelper")
    Retrieving 'https://api.github.com/repos/kaskr/TMB_contrib_R/tarball/8cb8bbfe4b77b4d864932a1f213092b53a7313f0' ...
    	OK [downloaded 2.7 Mb in 2.3 secs]
    Installing TMBhelper [1.2.0] ...
    	OK [built from source]
    * Copying 'TMBhelper' into the cache ... Done!
    

    Of course, I haven't documented this so there's no way you could've known. :-) I think:

    1. I should document this behavior;
    2. I should support the same syntax used by remotes; that is, user/repo/subdir, just for compatibility.

    For what it's worth, the reason I diverged in syntax here is because some public repositories (e.g. Gitlab) have the notion of groups / sub-groups, so I wanted to ensure that:

    group/subgroup/package:subdir
    

    that is, install package package living in the sub-directory subdir from the project referenced by group/subgroup would still work.

  2. DanOvando commented on Jul 28, 2020

    @DanOvando
    Author

    Got it, thanks. Makes sense to me. If documented the current solution works fine, but I suppose it does create a wrinkle in the reproducibility process in that packages that have Github dependencies that live in sub-directories of repos, and list the path to those dependencies in DESCRIPTION > Remotes like :

    Remotes: 
        kaskr/TMB_contrib_R/TMBhelper
    

    Will be installable via remotes but fail to install by renv. So, compatibility for both syntax would be good if possible!

  3. kevinushey commented on Jul 28, 2020

    @kevinushey
    Collaborator

    This should now be supported in the development version of renv -- thanks for the report!

    > renv::install("kaskr/TMB_contrib_R/TMBhelper", rebuild = TRUE)
    Retrieving 'https://api.github.com/repos/kaskr/TMB_contrib_R/tarball/8cb8bbfe4b77b4d864932a1f213092b53a7313f0' ...
    	OK [file is up to date]
    Installing TMBhelper [1.2.0] ...
    	OK [built from source]
    * Copying 'TMBhelper' into the cache ... Done!
    
  4. siri16100 commented on Nov 11, 2023

    @siri16100

    Hi @kevinushey I have the same issue when trying to install packages from a sub folder in a Azure-Devops repository. I can install the package using a : as delimiter but if fails with a /

    # good 
    renv::install("git::https://dev.azure.com/company-name/department/_git/repo/packages:package-name", rebuilt = T)
    # bad
    renv::install("git::https://dev.azure.com/company-name/department/_git/repo/packages/package-name", rebuilt = T)

    Using latter approach I get following error message:

    fatal: repository 'https://dev.azure.com/company-name/department/_git/repo/packages/package-name/' not found
    Error: failed to resolve remote 'git::https://dev.azure.com/company-name/department/_git/repo/packages/package-name' -- error cloning 'package-name' from 'https://dev.azure.com/company-name/department/_git/repo/packages/package-name' [status code 128]
    Traceback (most recent calls last):
    15: renv::install("git::https://dev.azure.com/company-name/department/_git/repo/packages/package-name", 
            rebuilt = T)
    14: map(packages, renv_remotes_resolve)
    13: lapply(x, f, ...)
    12: FUN(X[[i]], ...)
    11: withCallingHandlers(renv_remotes_resolve_impl(spec, latest), 
            error = error)
    10: renv_remotes_resolve_impl(spec, latest)
     9: renv_remotes_resolve_git(remote)
     8: renv_remotes_resolve_git_description(record)
     7: (function() {
            renv_scope_options(renv.verbose = FALSE)
            renv_retrieve_git_impl(record, path)
        })()
     6: renv_retrieve_git_impl(record, path)
     5: stopf(fmt, package, url, status)
     4: stop(sprintf(fmt, ...), call. = call.)
     3: .handleSimpleError(function (e) 
        {
            ...
        }, "error cloning 'package-name' from 'https://dev.azure.com/company-name/department/_git/repo/packages/package-name' [status code 128]", 
            base::quote(NULL))
     2: h(simpleError(msg, call))
     1: stop(simpleError(message = message, call = e$call))

    So in theory I just could use : but I also have dependencies in the same repo. In DESCRIPTION > Remotes I tried using both : and /, giving me following error

    fatal: unable to access 'https://dev.azure.com/company-name/department/_git/repos:packages/package-name/': The requested URL returned error: 400

    respectively

    fatal: repository 'https://dev.azure.com/company-name/department/_git/repos/packages/package-name/' not found

    might this be the same issue as above with github?

  5. kevinushey commented on Nov 13, 2023

    @kevinushey
    Collaborator

    I think so. I should petition remotes to consider allowing the syntax I've adopted here for sub-directories...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions