Skip to content

pak does not use binaries #863

Closed
Closed

Description

@janni-hr

On Posit Workbench, pak does not use binaries even if binaries should be available in theory (PPM setup). We use a private instance of PPM, but I also get this behaviour for the public PPM:

> pak::system_r_platform()
[1] "x86_64-pc-linux-gnu-ubuntu-22.04"
> getOption("repos")
                                                         CRAN 
"https://packagemanager.posit.co/cran/__linux__/jammy/latest" 
> pak::meta_list("glue")[["sources"]]
[[1]]
[1] "https://packagemanager.posit.co/cran/__linux__/jammy/latest/src/contrib/glue_1.8.1.tar.gz"
> pak::meta_list("fs")[["platform"]]
[1] "source"
> pak::cache_clean()
> pak::pkg_install("glue")
✔ Loading metadata database ... done
                                        
→ Will install 1 package.
→ Will download 1 package with unknown size.
+ glue   1.8.1 [bld][cmp][dl]
  
ℹ Getting 1 pkg with unknown size
✔ Got glue 1.8.1 (source) (173.80 kB)                                
✔ Downloaded 1 package (173.80 kB) in 1.2s                           
ℹ Building glue 1.8.1
✔ Built glue 1.8.1 (388ms)                                  
✔ Installed glue 1.8.1  (1.2s)                                
✔ 1 pkg: added 1, dld 1 (173.80 kB) [7.5s]   

pak_siterep():

> pak::pak_sitrep()
* pak version:
- 0.9.4
* Version information:
- pak platform: x86_64-pc-linux-gnu (current: x86_64-pc-linux-gnu, compatible)
- pak repository: - (local install?)
* Optional packages installed:
- pillar
* Library path:
- /nfs-data/rhome/rgi/R/x86_64-pc-linux-gnu-library/4.5
- /opt/R/4.5.2/lib/R/library
* pak is installed at /nfs-data/rhome/rgi/R/x86_64-pc-linux-gnu-library/4.5/pak.
* Dependency versions:
- callr      3.7.6     
- cli        3.6.6     
- curl       5.2.3     
- desc       1.4.3     
- filelock   1.0.3     
- jsonlite   2.0.0     
- keyring    1.4.1     
- lpSolve    5.6.23    
- pkgbuild   1.4.8     
- pkgcache   2.2.5.9000
- pkgdepends 0.9.1.9000
- pkgsearch  3.1.5     
- processx   3.8.7     
- ps         1.9.2     
- R6         2.5.1     
- yaml       2.3.12    
- zip        2.3.3     
* Dependencies can be loaded

Activity

  1. gaborcsardi commented on Apr 22, 2026

    @gaborcsardi
    Member

    I can't reproduce this:

    FROM ghcr.io/r-lib/rig/ubuntu-22.04
    RUN R -q -e 'getOption("repos")'
    RUN R -q -e 'pak::pkg_install("glue")'
    ❯ docker build --progress plain --platform linux/amd64 .
    #0 building with "rancher-desktop" instance using docker driver
    
    #1 [internal] load build definition from Dockerfile
    #1 transferring dockerfile: 145B done
    #1 DONE 0.0s
    
    #2 [internal] load metadata for ghcr.io/r-lib/rig/ubuntu-22.04:latest
    #2 DONE 0.0s
    
    #3 [internal] load .dockerignore
    #3 transferring context: 2B done
    #3 DONE 0.0s
    
    #4 [1/3] FROM ghcr.io/r-lib/rig/ubuntu-22.04:latest@sha256:09eeab66070b17b4d086930c3592484816c661fec3fb84c6425fe141670fd78b
    #4 resolve ghcr.io/r-lib/rig/ubuntu-22.04:latest@sha256:09eeab66070b17b4d086930c3592484816c661fec3fb84c6425fe141670fd78b 0.0s done
    #4 DONE 0.0s
    
    #4 [1/3] FROM ghcr.io/r-lib/rig/ubuntu-22.04:latest@sha256:09eeab66070b17b4d086930c3592484816c661fec3fb84c6425fe141670fd78b
    #4 DONE 0.1s
    
    #5 [2/3] RUN R -q -e 'getOption("repos")'
    #5 1.615 > getOption("repos")
    #5 1.617                                                           P3M
    #5 1.618 "https://packagemanager.posit.co/cran/__linux__/jammy/latest"
    #5 1.618                                                          CRAN
    #5 1.618                                 "https://cloud.r-project.org"
    #5 1.618 >
    #5 DONE 1.7s
    
    #6 [3/3] RUN R -q -e 'pak::pkg_install("glue")'
    #6 1.695 > pak::pkg_install("glue")
    #6 8.066
    #6 13.02 ✔ Updated metadata database: 6.09 MB in 10 files.
    #6 13.03
    #6 13.04 ℹ Updating metadata database
    #6 64.10 ✔ Updating metadata database ... done
    #6 64.11
    #6 65.46
    #6 65.50 → Will install 1 package.
    #6 65.59 → Will download 1 package with unknown size.
    #6 65.61 + glue   1.8.1 [dl]
    #6 65.62
    #6 66.26 ℹ Getting 1 pkg with unknown size
    #6 67.49 ✔ Got glue 1.8.1 (x86_64-pc-linux-gnu-ubuntu-22.04) (173.80 kB)
    #6 68.17 ✔ Installed glue 1.8.1  (261ms)
    #6 68.23 ✔ 1 pkg: added 1, dld 1 (173.80 kB) [1m 6.4s]
    #6 68.24 >
    #6 DONE 68.5s
    
  2. janni-hr commented on Apr 22, 2026

    @janni-hr
    Author

    Thank you. If I configure the repos the same way as you do, it works as expected for the public PPM. However, it does not work for our private instance. I’ve looked into it a bit further and I think it has to do with the URL of our PPM. It has the form

    {base}/cran-repo/__linux__/jammy/latest
    

    pkgcache:::is_ppm_linux_repo_url() returns FALSE for our URL, because of the "(?<repo>cran|all)/" in pkgcache:::re_ppm_linux(). And this causes pkgcache:::ppm_binary_url() to return NA.

    Could this be the problem? And if yes, is there a way to work around it?

  3. gaborcsardi commented on Apr 22, 2026

    @gaborcsardi
    Member

    Yes, that's probably the problem. I can modify the regex, this is probably enough:

    grepl(
      "^(?<base>.*/)(?<repo>[^/]+)/__linux__/(?<distro>[a-zA-Z0-9]+)/(?<version>latest|[-0-9]+)$", 
      "{base}/cran-repo/__linux__/jammy/latest", 
      perl = TRUE
    )
    #> [1] TRUE
    

    I.e. to allow any URL before the __linux__ part.

  4. gaborcsardi commented on Apr 22, 2026

    @gaborcsardi
    Member

    Should be fixed in tomorrows nightly devel build, if you can install them on your system. See https://pak.r-lib.org/reference/install.html#nightly-builds

  5. janni-hr commented on Apr 23, 2026

    @janni-hr
    Author

    It works now as expected with the night devel build. Thank you!

  6. gaborcsardi commented on Apr 28, 2026

    @gaborcsardi
    Member

    This is now released in pak 0.9.5.

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