rstudio / renv

renv: Project environments for R.
https://rstudio.github.io/renv/
MIT License
1k stars 152 forks source link

Issue with github packages whos names have changed. #969

Closed andrewelamb closed 1 year ago

andrewelamb commented 2 years ago

I changes a couple of package names in github and renv seems to be having some issues:

iatlas.api.client got changed to iatlasGraphqlClient iatlas.modules got changed to iatlasModules

They are up to 
> renv::update()
* Checking for updated packages ... Done!
The following package(s) will be updated:

# GitHub =============================
- iatlasGraphqlClient   [CRI-iAtlas/iatlas.api.client@main: unchanged]
- iatlasModules         [CRI-iAtlas/iatlas.modules: unchanged]

Do you want to proceed? [y/N]: y
Retrieving 'https://api.github.com/repos/CRI-iAtlas/iatlas.api.client/tarball/e7cae563a0735b4fb4e00ec15487c73058add809' ...
    OK [downloaded 35.3 Kb in 1 secs]
Retrieving 'https://api.github.com/repos/CRI-iAtlas/iatlas.modules/tarball/6d1acdd28e0984a1788fad8235c1b231a4bb7330' ...
    OK [downloaded 46.1 Kb in 0.9 secs]
Installing iatlasGraphqlClient [0.28.0] ...
    OK [built from source]
Moving iatlasGraphqlClient [0.28.0] into the cache ...
    OK [moved to cache in 0.25 milliseconds]
Installing iatlasModules [0.8.0] ...
    OK [built from source]
Moving iatlasModules [0.8.0] into the cache ...
    OK [moved to cache in 0.21 milliseconds]

Every time I try to update to it attempts to update those package as well, and from the old url(https://api.github.com/repos/CRI-iAtlas/iatlas.api.client/tarball).

In addition it sets the the RemoteRepo in the lock file to you old name:

"iatlasGraphqlClient": {
      "Package": "iatlasGraphqlClient",
      "Version": "0.28.0",
      "Source": "GitHub",
      "RemoteType": "github",
      "RemoteUsername": "CRI-iAtlas",
      "RemoteRepo": "iatlas.api.client",
      "RemoteRef": "main",
      "RemoteSha": "e7cae563a0735b4fb4e00ec15487c73058add809",
      "RemoteHost": "api.github.com",
      "Hash": "10a3dc6198f2b8a73731e90197351705",
      "Requirements": [
        "assertthat",
        "dplyr",
        "ghql",
        "jsonlite",
        "magrittr",
        "purrr",
        "rlang",
        "snakecase",
        "stringr",
        "tibble",
        "tidyr"
      ]
    },
    "iatlasModules": {
      "Package": "iatlasModules",
      "Version": "0.8.0",
      "Source": "GitHub",
      "RemoteType": "github",
      "RemoteUsername": "CRI-iAtlas",
      "RemoteRepo": "iatlas.modules",
      "RemoteRef": "master",
      "RemoteSha": "6d1acdd28e0984a1788fad8235c1b231a4bb7330",
      "RemoteHost": "api.github.com",
      "Hash": "7e9a87a234dda20b05c5ef4b841f2b24",
      "Requirements": [
        "RColorBrewer",
        "crayon",
        "dplyr",
        "htmltools",
        "magrittr",
        "markdown",
        "pillar",
        "pkgcond",
        "plotly",
        "purrr",
        "readr",
        "rlang",
        "shiny",
        "shinycssloaders",
        "shinydashboard",
        "stringr",
        "tibble",
        "tidyr",
        "tidyselect",
        "viridis"
      ]
    }

I'm wondering if this is an renv issue or in how I changed the name of those repo/packages.

Thanks!

kevinushey commented 2 years ago

Does reinstalling those packages explicitly from the new location help? For example:

renv::install("CRI-iAtlas/iatlasGraphqlClient")
renv::install("CRI-iAtlas/iatlasModules")

If I do this and then try to snapshot, I see:

    "iatlasGraphqlClient": {
      "Package": "iatlasGraphqlClient",
      "Version": "0.28.0",
      "Source": "GitHub",
      "RemoteType": "github",
      "RemoteHost": "api.github.com",
      "RemoteUsername": "CRI-iAtlas",
      "RemoteRepo": "iatlasGraphqlClient",
      "RemoteRef": "main",
      "RemoteSha": "e7cae563a0735b4fb4e00ec15487c73058add809",
      "Hash": "93a649195596b42e4cf13ca26dd8614d",
      "Requirements": [
        "assertthat",
        "dplyr",
        "ghql",
        "jsonlite",
        "magrittr",
        "purrr",
        "rlang",
        "snakecase",
        "stringr",
        "tibble",
        "tidyr"
      ]
    },
andrewelamb commented 2 years ago

Thanks for the help @kevinushey!

It does help, but I'm back to where I started after that:

> renv::install("CRI-iAtlas/iatlasGraphqlClient")
Installing iatlasGraphqlClient [0.28.0] ...
    OK [linked cache]
> renv::install("CRI-iAtlas/iatlasModules")
Installing iatlasModules [0.8.0] ...
    OK [linked cache]
> renv::snapshot()
The following package(s) will be updated in the lockfile:

# GitHub =============================
- iatlasGraphqlClient   [repo: iatlas.api.client -> iatlasGraphqlClient]
- iatlasModules         [repo: iatlas.modules -> iatlasModules]

Do you want to proceed? [y/N]: y
* Lockfile written to '~/repos/iatlasModules2/renv.lock'.
> renv::update()
* Querying repositories for available source packages ... Done!
* Checking for updated packages ... Done!
The following package(s) will be updated:

# GitHub =============================
- iatlasGraphqlClient   [repo: iatlasGraphqlClient -> iatlas.api.client]
- iatlasModules         [repo: iatlasModules -> iatlas.modules]

Retrieving 'https://api.github.com/repos/CRI-iAtlas/iatlas.api.client/tarball/e7cae563a0735b4fb4e00ec15487c73058add809' ...
    OK [downloaded 35.3 Kb in 1.1 secs]
Retrieving 'https://api.github.com/repos/CRI-iAtlas/iatlas.modules/tarball/6d1acdd28e0984a1788fad8235c1b231a4bb7330' ...
    OK [downloaded 46.1 Kb in 1.2 secs]
Installing iatlasGraphqlClient [0.28.0] ...
    OK [built from source]
Moving iatlasGraphqlClient [0.28.0] into the cache ...
    OK [moved to cache in 0.24 milliseconds]
Installing iatlasModules [0.8.0] ...
    OK [built from source]
Moving iatlasModules [0.8.0] into the cache ...
    OK [moved to cache in 0.21 milliseconds]
> renv::snapshot()
The following package(s) will be updated in the lockfile:

# GitHub =============================
- iatlasGraphqlClient   [repo: iatlasGraphqlClient -> iatlas.api.client]
- iatlasModules         [repo: iatlasModules -> iatlas.modules]

Do you want to proceed? [y/N]: y
* Lockfile written to '~/repos/iatlasModules2/renv.lock'.
*     "iatlasGraphqlClient": {
      "Package": "iatlasGraphqlClient",
      "Version": "0.28.0",
      "Source": "GitHub",
      "RemoteType": "github",
      "RemoteUsername": "CRI-iAtlas",
      "RemoteRepo": "iatlas.api.client",
      "RemoteRef": "main",
      "RemoteSha": "e7cae563a0735b4fb4e00ec15487c73058add809",
      "RemoteHost": "api.github.com",
      "Hash": "10a3dc6198f2b8a73731e90197351705",
      "Requirements": [
        "assertthat",
        "dplyr",
        "ghql",
        "jsonlite",
        "magrittr",
        "purrr",
        "rlang",
        "snakecase",
        "stringr",
        "tibble",
        "tidyr"
      ]
    },
    "iatlasModules": {
      "Package": "iatlasModules",
      "Version": "0.8.0",
      "Source": "GitHub",
      "RemoteType": "github",
      "RemoteUsername": "CRI-iAtlas",
      "RemoteRepo": "iatlas.modules",
      "RemoteRef": "master",
      "RemoteSha": "6d1acdd28e0984a1788fad8235c1b231a4bb7330",
      "RemoteHost": "api.github.com",
      "Hash": "7e9a87a234dda20b05c5ef4b841f2b24",
      "Requirements": [
        "RColorBrewer",
        "crayon",
        "dplyr",
        "htmltools",
        "magrittr",
        "markdown",
        "pillar",
        "pkgcond",
        "plotly",
        "purrr",
        "readr",
        "rlang",
        "shiny",
        "shinycssloaders",
        "shinydashboard",
        "stringr",
        "tibble",
        "tidyr",
        "tidyselect",
        "viridis"
      ]
    },

 

kevinushey commented 2 years ago

Strange; I don't see that.

> str(renv:::renv_description_read(package = "iatlasGraphqlClient"))
List of 28
 $ Package                : chr "iatlasGraphqlClient"
 $ Title                  : chr "iatlas Graphql Client"
 $ Type                   : chr "Package"
 $ Version                : chr "0.28.0"
 $ Author                 : chr "Andrew Lamb"
 $ Maintainer             : chr "Andrew Lamb <Andrew.Lamb@sagebase.org>"
 $ Description            : chr "This package is am R Client library for the iAtlas API."
 $ License                : chr "MIT + file LICENSE"
 $ Encoding               : chr "UTF-8"
 $ LazyData               : chr "true"
 $ Suggests               : chr "devtools, testthat (>= 3.0), usethis"
 $ RoxygenNote            : chr "7.1.2"
 $ Config/testthat/edition: chr "3"
 $ Imports                : chr "assertthat, dplyr (>= 1.0), ghql (>= 0.1), jsonlite (>= 1.7), magrittr\n    (>= 2.0), purrr (>= 0.3), rlang (>="| __truncated__
 $ URL                    : chr "https://github.com/CRI-iAtlas/iatlasGraphqlClient"
 $ BugReports             : chr "https://github.com/CRI-iAtlas/iatlasGraphqlClient/issues"
 $ Built                  : chr "R 4.2.0; ; 2022-03-25 21:23:44 UTC; unix"
 $ RemoteType             : chr "github"
 $ RemoteHost             : chr "api.github.com"
 $ RemoteUsername         : chr "CRI-iAtlas"
 $ RemoteRepo             : chr "iatlasGraphqlClient"
 $ RemoteRef              : chr "main"
 $ RemoteSha              : chr "e7cae563a0735b4fb4e00ec15487c73058add809"
 $ GithubHost             : chr "api.github.com"
 $ GithubRepo             : chr "iatlasGraphqlClient"
 $ GithubUsername         : chr "CRI-iAtlas"
 $ GithubRef              : chr "main"
 $ GithubSHA1             : chr "e7cae563a0735b4fb4e00ec15487c73058add809"
> renv::update()
* Checking for updated packages ... Done!
* All packages appear to be up-to-date.

One other thing to check, just in case -- does it make a difference if you restart R after reinstalling the two packages?

andrewelamb commented 2 years ago

I reinstalled those two packages as before, and then restarted R, and I'm still seeing the issue with renv:update()

andrewelamb commented 2 years ago

Is it possible the renv cache needs to be deleted(or at least the packages removed from the cache?)

kevinushey commented 2 years ago

Is it possible the renv cache needs to be deleted(or at least the packages removed from the cache?)

Aha, you are probably right. You could use renv::install(..., rebuild = TRUE) to force the package to be rebuilt and reinstalled (bypassing the cache).

andrewelamb commented 2 years ago

Aha, you are probably right. You could use renv::install(..., rebuild = TRUE) to force the package to be rebuilt and reinstalled (bypassing the cache).

I tried this and it didn't work:

> renv::install("CRI-iAtlas/iatlasGraphqlClient", rebuild = TRUE)
Retrieving 'https://api.github.com/repos/CRI-iAtlas/iatlasGraphqlClient/tarball/e7cae563a0735b4fb4e00ec15487c73058add809' ...
    OK [downloaded 35.3 Kb in 0.7 secs]
Installing iatlasGraphqlClient [0.28.0] ...
    OK [built from source]
Moving iatlasGraphqlClient [0.28.0] into the cache ...
    OK [moved to cache in 0.34 milliseconds]
> renv::install("CRI-iAtlas/iatlasModules", rebuild = TRUE)
Retrieving 'https://api.github.com/repos/CRI-iAtlas/iatlasModules/tarball/6d1acdd28e0984a1788fad8235c1b231a4bb7330' ...
    OK [downloaded 46.1 Kb in 0.8 secs]
Installing iatlasModules [0.8.0] ...
    OK [built from source]
Moving iatlasModules [0.8.0] into the cache ...
    OK [moved to cache in 0.25 milliseconds]
> renv::snapshot()
* Lockfile written to '~/repos/iatlasModules2/renv.lock'.
> renv::update()
* Querying repositories for available source packages ... Done!
* Checking for updated packages ... Done!
The following package(s) will be updated:

# CRAN ===============================
- DT                    [0.21 -> 0.22]
- crayon                [repo: RSPM -> CRAN; ver: 1.5.0 -> 1.5.1]
- tzdb                  [repo: RSPM -> CRAN; ver: 0.2.0 -> 0.3.0]

# GitHub =============================
- iatlasGraphqlClient   [repo: iatlasGraphqlClient -> iatlas.api.client]
- iatlasModules         [repo: iatlasModules -> iatlas.modules]

Do you want to proceed? [y/N]: n
* Operation canceled.
kevinushey commented 2 years ago

Sorry, but I'm still not able to reproduce.

Are you still able to reproduce in a brand-new, independent renv project?

> renv::install("CRI-iAtlas/iatlasGraphqlClient", rebuild = TRUE)
Retrieving 'https://api.github.com/repos/CRI-iAtlas/iatlasGraphqlClient/tarball/e7cae563a0735b4fb4e00ec15487c73058add809' ...
        OK [downloaded 35.3 Kb in 0.4 secs]
Installing iatlasGraphqlClient [0.28.0] ...
        OK [built from source]
Moving iatlasGraphqlClient [0.28.0] into the cache ...
        OK [moved to cache in 0.26 milliseconds]
> renv::snapshot()
The following package(s) will be updated in the lockfile:

# CRAN ===============================
- R6                    [* -> 2.5.1]
- Rcpp                  [* -> 1.0.8.3]
- assertthat            [* -> 0.2.1]
- cli                   [* -> 3.2.0]
- cpp11                 [* -> 0.4.2]
- crayon                [* -> 1.5.1]
- crul                  [* -> 1.2.0]
- curl                  [* -> 4.3.2]
- dplyr                 [* -> 1.0.8]
- ellipsis              [* -> 0.3.2]
- fansi                 [* -> 1.0.3]
- generics              [* -> 0.1.2]
- ghql                  [* -> 0.1.0]
- glue                  [* -> 1.6.2]
- graphql               [* -> 1.5]
- httpcode              [* -> 0.3.0]
- jsonlite              [* -> 1.8.0]
- lifecycle             [* -> 1.0.1]
- magrittr              [* -> 2.0.2]
- mime                  [* -> 0.12]
- pillar                [* -> 1.7.0]
- pkgconfig             [* -> 2.0.3]
- purrr                 [* -> 0.3.4]
- rlang                 [* -> 1.0.2]
- snakecase             [* -> 0.11.0]
- stringi               [* -> 1.7.6]
- stringr               [* -> 1.4.0]
- tibble                [* -> 3.1.6]
- tidyr                 [* -> 1.2.0]
- tidyselect            [* -> 1.1.2]
- triebeard             [* -> 0.3.0]
- urltools              [* -> 1.7.3]
- utf8                  [* -> 1.2.2]
- vctrs                 [* -> 0.3.8]

# GitHub =============================
- iatlasGraphqlClient   [* -> CRI-iAtlas/iatlasGraphqlClient@main]

Do you want to proceed? [y/N]: y
* Lockfile written to '~/scratch/example/renv.lock'.
> renv::update()
* Querying repositories for available source packages ... Done!
* Checking for updated packages ... Done!
The following package(s) will be updated:

# CRAN ===============================
- MASS       [7.3-55 -> 7.3-56]
- Matrix     [1.4-0 -> 1.4-1]
- cluster    [2.1.2 -> 2.1.3]
- nlme       [3.1-155 -> 3.1-157]
- survival   [3.2-13 -> 3.3-1]

Do you want to proceed? [y/N]: y
andrewelamb commented 2 years ago

Hmm that does work in a new project:

> renv::install("CRI-iAtlas/iatlasGraphqlClient", rebuild = TRUE)
Retrieving 'https://api.github.com/repos/CRI-iAtlas/iatlasGraphqlClient/tarball/e7cae563a0735b4fb4e00ec15487c73058add809' ...
    OK [downloaded 35.3 Kb in 0.8 secs]
Retrieving 'https://cloud.r-project.org/src/contrib/crayon_1.5.1.tar.gz' ...
    OK [downloaded 39.2 Kb in 0.2 secs]
Installing assertthat [0.2.1] ...
    OK [copied cache]
Installing generics [0.1.2] ...
    OK [copied cache]
Installing glue [1.6.2] ...
    OK [copied cache]
Installing rlang [1.0.2] ...
    OK [copied cache]
Installing lifecycle [1.0.1] ...
    OK [copied cache]
Installing magrittr [2.0.2] ...
    OK [copied cache]
Installing R6 [2.5.1] ...
    OK [copied cache]
Installing ellipsis [0.3.2] ...
    OK [copied cache]
Installing fansi [1.0.3] ...
    OK [copied cache]
Installing cli [3.2.0] ...
    OK [copied cache]
Installing crayon [1.5.1] ...
    OK [built from source]
Copying crayon [1.5.1] into the cache ...
    OK [copied to cache in 3.4 milliseconds]
Installing utf8 [1.2.2] ...
    OK [copied cache]
Installing vctrs [0.3.8] ...
    OK [copied cache]
Installing pillar [1.7.0] ...
    OK [copied cache]
Installing pkgconfig [2.0.3] ...
    OK [copied cache]
Installing tibble [3.1.6] ...
    OK [copied cache]
Installing purrr [0.3.4] ...
    OK [copied cache]
Installing tidyselect [1.1.2] ...
    OK [copied cache]
Installing dplyr [1.0.8] ...
    OK [copied cache]
Installing curl [4.3.2] ...
    OK [copied cache]
Installing Rcpp [1.0.8.3] ...
    OK [copied cache]
Installing triebeard [0.3.0] ...
    OK [copied cache]
Installing urltools [1.7.3] ...
    OK [copied cache]
Installing httpcode [0.3.0] ...
    OK [copied cache]
Installing jsonlite [1.8.0] ...
    OK [copied cache]
Installing mime [0.12] ...
    OK [copied cache]
Installing crul [1.2.0] ...
    OK [copied cache]
Installing graphql [1.5] ...
    OK [copied cache]
Installing ghql [0.1.0] ...
    OK [copied cache]
Installing stringi [1.7.6] ...
    OK [copied cache]
Installing stringr [1.4.0] ...
    OK [copied cache]
Installing snakecase [0.11.0] ...
    OK [copied cache]
Installing cpp11 [0.4.2] ...
    OK [copied cache]
Installing tidyr [1.2.0] ...
    OK [copied cache]
Installing iatlasGraphqlClient [0.28.0] ...
    OK [built from source]
Copying iatlasGraphqlClient [0.28.0] into the cache ...
    OK [copied to cache in 4.1 milliseconds]
> renv::snapshot()

This project has not yet been activated.
Activating this project will ensure the project library is used during snapshot.
Please see `?renv::activate` for more details.

Would you like to activate this project before snapshot? [Y/n]: y
* Project '~/repos/test' loaded. [renv 0.15.4]
The following package(s) will be updated in the lockfile:

# CRAN ===============================
- renv   [* -> 0.15.4]

Do you want to proceed? [y/N]: y
* Lockfile written to '~/repos/test/renv.lock'.
> renv::update()
* Checking for updated packages ... Done!
The following package(s) will be updated:

# CRAN ===============================
- MASS       [7.3-55 -> 7.3-56]
- Matrix     [1.4-0 -> 1.4-1]
- cluster    [2.1.2 -> 2.1.3]
- nlme       [3.1-155 -> 3.1-157]
- spatial    [7.3-11 -> 7.3-15]
- survival   [3.2-13 -> 3.3-1]

Do you want to proceed? [y/N]: n
kevinushey commented 2 years ago

Is there anything unique in that project that might affect how renv resolves its remotes? (E.g. do you have a DESCRIPTION file with a Remotes: field?)

Or, can you share the project where you're seeing this behavior?

andrewelamb commented 2 years ago

I do: description file

I changed them to the new repo names though.

hadley commented 1 year ago

@andrewelamb Are you still interested in following up on this issue?

andrewelamb commented 1 year ago

@hadley No that's OK, I've moved on frrm this project.