pak icon indicating copy to clipboard operation
pak copied to clipboard

Change option `repos` cause `lockfile_create` to hang forever

Open lz100 opened this issue 1 year ago • 3 comments

If one changes the repos option before running lockfile_create, R hangs forever without any message.

options(repos = c(PPM = "https://packagemanager.posit.co/cran/latest"))
pak::lockfile_create()

#✔ Loading metadata database ... done
# ℹ Creating lockfile pkg.lock  

Even if I include the CRAN option inside, the result is the same.

options(repos = c(
  CRAN = "https://cloud.r-project.org",
  PPM = "https://packagemanager.posit.co/cran/latest"
))
pak::lockfile_create()

It only works with one single CRAN option

options(repos = c(
  CRAN = "https://cran.rstudio.com"
))
pak::lockfile_create()

# ✔ Loading metadata database ... done
# ✔ Created lockfile pkg.lock [3s]

lz100 avatar Aug 15 '24 23:08 lz100

That's not what I see. Can you try to create a reproducible example?

❯ options(repos = c(
+   CRAN = "https://cloud.r-project.org",
+   PPM = "https://packagemanager.posit.co/cran/latest"
+ ))

❯ system.time(pak::lockfile_create())
✔ Created lockfile pkg.lock [46ms]
   user  system elapsed
  0.030   0.002   0.138

gaborcsardi avatar Aug 17 '24 17:08 gaborcsardi

Please see this reproducible example: https://github.com/lz100/pak_issue/actions/runs/10462815978/job/28973744653

        install.packages("pak", repos = sprintf("https://r-lib.github.io/p/pak/stable/%s/%s/%s", .Platform$pkgType, R.Version()$os, R.Version()$arch))
        options(repos = c(
          CRAN = "https://cloud.r-project.org",
          PPM = "https://packagemanager.posit.co/cran/latest"
        ))
        pak::lockfile_create()

and the repo associated with the workflow

lz100 avatar Aug 20 '24 00:08 lz100

Yes, https://packagemanager.posit.co/cran/latestis essentially the same repository as https://cloud.r-project.org/ for Linux, they contain the same exact source packages. The dependency solver cannot deal with this, as any combination of the dependencies from the two repos are exactly as good. This is a known issue in pak, and hopefully we'll solve it soon.

The current workaround is not using (essentially) the same repo twice. E.g. if you want to use the binaries from PPM, use the https://packagemanager.posit.co/cran/linux/jammy/latest URL (for Ubuntu Jammy).

gaborcsardi avatar Aug 20 '24 08:08 gaborcsardi