Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

renv::restore with pak errors when using a custom git package #1974

Open
LeeMendelowitz opened this issue Aug 25, 2024 · 8 comments
Open

renv::restore with pak errors when using a custom git package #1974

LeeMendelowitz opened this issue Aug 25, 2024 · 8 comments

Comments

@LeeMendelowitz
Copy link

When using pak with renv 1.0.7, I'm getting in error when trying to renv::restore() using a custom git repo. I'm able to renv::install the package with pak, it's just the restore that fails with an error.

Here's an example of how I installed from a custom git repo (where I replaced my actual url with a dummy url). The install with pak worked fine, and update the renv.lock:

renv::install('git::https://gitlab.example.net/path/example.git')

# Or could use a local repo:
# renv::install("~/projects/example")

renv::snapshot()

The renv.lock has:

    "example": {
      "Package": "example",
      "Version": "1.0.0",
      "Source": "git",
      "RemoteType": "git",
      "RemoteUrl": "https://gitlab.example.net/path/example.git",
      "RemotePkgRef": "git::https://gitlab.example.net/path/example.git",
      "RemoteRef": "HEAD",
      "RemoteSha": "xxx",
      "Requirements": [
        "DBI",
        "R",
        "tibble"
      ],
      "Hash": "xxx"
    },

To test the renv::restore(), I rm -rf renv/library. But a call to renv::restore() with this lock file will fail with:

# Installing packages --------------------------------------------------------
- Installing pak ...                            OK [linked from cache]
Successfully installed 1 package in 13 milliseconds.
✔ Loading metadata database ... done
Error:
! error in pak subprocess
Caused by error:
! Could not solve package dependencies:
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: Can't find package called [email protected].
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
* [email protected]: dependency conflict
Type .Last.error to see the more details.
Traceback (most recent calls last):
6: renv::restore()
5: renv_pak_restore(lockfile = lockfile, packages = packages, exclude = exclude,
       project = project)
4: pak$pkg_install(remotes)
3: remote(function(...) get("pkg_install_make_plan", asNamespace("pak"))(...),
       list(pkg = pkg, lib = lib, upgrade = upgrade, ask = ask,
           start = start, dependencies = dependencies, loaded = loaded_packages(lib)))
2: err$throw(res$error)
1: base::stop(cond)

The same error occurs if I try installing a local git repo (i.e. renv::install("~/projects/example").

SessionInfo

> sessionInfo()
R version 4.3.2 (2023-10-31)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Monterey 12.7.1

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: America/Chicago
tzcode source: internal

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

loaded via a namespace (and not attached):
[1] compiler_4.3.2 tools_4.3.2    renv_1.0.7     pak_0.8.0
@kevinushey
Copy link
Collaborator

This sounds somewhat similar to

renv/NEWS.md

Lines 68 to 70 in fcfe748

* Fixed an issue with `renv`'s `pak` integration where `renv` could install the
wrong version of a GitHub package during restore if
`options(renv.config.pak.enabled = TRUE)` was set. (#1883)
-- do you see the same issue in the development version of renv?

@LeeMendelowitz
Copy link
Author

@kevinushey

Yes, this is still an issue in the latest development version of renv. When I try to restore an renv.lock that was generated without pak enabled that uses the custom git repo, I get the error above.

@kevinushey
Copy link
Collaborator

kevinushey commented Sep 26, 2024

Thanks -- do you by any chance have a standalone reproducible example I could use for testing? (Can the issue be reproduced readily using any publicly-available R packages on GitHub, but using git references to access those?)

@LeeMendelowitz
Copy link
Author

Yup I was able to get a reproducible example using the gt package. Interestingly, calling renv::install("git::[email protected]:rstudio/gt.git") with pak enabled errors out, which might be the heart of the issue. The restore of a lockfile with pak enabled also errors out.

export RENV_CONFIG_CACHE_ENABLED=FALSE


# Step A: Install gt package from GitHub over SSH
# This works fine.
R --no-save <<EOF
renv::init()
renv::install("git::[email protected]:rstudio/gt.git")
renv::snapshot(type="all")
EOF


# Step B: Try restoring with pak enabled. This fails.
RENV_CONFIG_PAK_ENABLED=TRUE R --no-save <<EOF
renv::restore()
EOF


# Step C: Repeat without pak enabled. This works fine.
# It says "The library is already synchronized with the lockfile."
RENV_CONFIG_PAK_ENABLED=FALSE R --no-save <<EOF
renv::restore()
EOF


# Step D: Calling renv::install() with pak enabled also fails.
RENV_CONFIG_PAK_ENABLED=TRUE R --no-save <<EOF
renv::install("git::[email protected]:rstudio/gt.git")
EOF

@LeeMendelowitz
Copy link
Author

@kevinushey Sorry forgot to mention you in last comment - I added a reproducible example above.

@kevinushey
Copy link
Collaborator

Thanks @LeeMendelowitz -- I'm going to take a look.

@kevinushey
Copy link
Collaborator

kevinushey commented Oct 11, 2024

That example fails for me with:

> pak::pkg_install("git::[email protected]:rstudio/gt.git")
Error: 
! error in pak subprocess
Caused by error: 
! Could not solve package dependencies:
* git::[email protected]:rstudio/gt.git: ! pkgdepends resolution error for git::[email protected]:rstudio/gt.git.
Caused by error: 
! Failed to download DESCRIPTION from git repo at <://[email protected]:rstudio/gt.git>.
Caused by error in `(function (e) …`:
! URL rejected: Port number was not a decimal number between 0 and 65535
Type .Last.error to see the more details.

so I think this is not yet supported in pak.

@kevinushey
Copy link
Collaborator

r-lib/pak#705 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants