pak icon indicating copy to clipboard operation
pak copied to clipboard

`pak` unable to install Linux binary packages from PPM's new `bin/linux` repo URLs

Open glin opened this issue 5 months ago • 1 comments

This was first reported by @markrtucker

PPM just added support for Linux binary repo URLs like https://p3m.dev/cran/latest/bin/linux/noble-x86_64/4.5, which are equivalent to the existing __linux__/noble URLs but instead encode the R version and arch in the URL and not the user agent. Same as R-universe's Linux binary URLs.

These URLs don't seem to be working with pak though for some reason, as pak seemingly downloads the binary but ends up compiling a source package instead.

Here's a repro for Ubuntu 24 using Boom as an example:

options(repos = c(CRAN = sprintf("https://p3m.dev/cran/latest/bin/linux/noble-%s/%s", R.version["arch"], substr(getRversion(), 1, 3))))

pak::pkg_install("Boom")

# ℹ Getting 1 pkg (2.50 MB)
# ✔ Got Boom 0.9.16 (source) (118.46 MB)                              
# ✔ Downloaded 1 package (118.46 MB) in 4.5s                          
# ℹ Building Boom 0.9.16
# ✔ Built Boom 0.9.16 (1m 45.3s)                             

pak gets the Boom binary, the 118 MB file, but still compiles a source package for some reason. The 2.50 MB file above matches the Boom source file.

pak can install from R-universe Linux binary repo URLs just fine though. I am not sure what the difference is, but I did see that R-universe PACKAGES files have a Platform field in them. I haven't heard about the Platform field anywhere though, except seeing it in this recent issue https://github.com/r-lib/pak/issues/773

glin avatar Oct 09 '25 22:10 glin

can confirm this issue. install.packages works for the binaries too. the response headers seem to indicate ppm is returning binaries

root@38f66f676192:/# curl -H "User-Agent: R (4.5.2 x86_64-pc-linux-gnu x86_64 linux-gnu)" -I 'https://packagemanager.posit.co/cran/__linux__/noble/latest/src/contrib/Boom_0.9.16.tar.gz'
HTTP/2 200
date: Mon, 24 Nov 2025 02:13:55 GMT
content-type: binary/octet-stream
content-length: 118464752
cache-control: max-age=3600
content-disposition: attachment; filename="Boom_0.9.16.tar.gz"
last-modified: Wed, 03 Sep 2025 17:02:21 GMT
request-id: 72d8a471-33dd-48e3-854f-e5f5f45bb181
server: Posit Package Manager v2025.09.2-10
x-content-type-options: nosniff
x-frame-options: DENY
x-package-binary-tag: 4.5-noble
x-package-type: binary
x-repository-type: RSPM

root@38f66f676192:/# curl -I "https://packagemanager.posit.co/cran/latest/bin/linux/noble-x86_64-pc-linux-gnu/4.5/src/contrib/Boom_0.9.16.tar.gz"
HTTP/2 200
date: Mon, 24 Nov 2025 02:14:22 GMT
content-type: binary/octet-stream
content-length: 118464752
cache-control: max-age=3600
content-disposition: attachment; filename="Boom_0.9.16.tar.gz"
last-modified: Wed, 03 Sep 2025 17:02:21 GMT
request-id: faf7afe6-0b01-4599-a414-2efcc7d1d972
server: Posit Package Manager v2025.09.2-10
x-content-type-options: nosniff
x-frame-options: DENY
x-package-binary-tag: 4.5-noble
x-package-type: binary
x-repository-type: RSPM

root@38f66f676192:/# curl -I "https://packagemanager.posit.co/cran/latest/bin/linux/noble-x86_64/4.5/src/contrib/Boom_0.9.16.tar.gz"
HTTP/2 200
date: Mon, 24 Nov 2025 02:14:33 GMT
content-type: binary/octet-stream
content-length: 118464752
cache-control: max-age=3600
content-disposition: attachment; filename="Boom_0.9.16.tar.gz"
last-modified: Wed, 03 Sep 2025 17:02:21 GMT
request-id: 64b808a1-0876-4b54-a1a4-fef0a2697c4d
server: Posit Package Manager v2025.09.2-10
x-content-type-options: nosniff
x-frame-options: DENY
x-package-binary-tag: 4.5-noble
x-package-type: binary
x-repository-type: RSPM

the direct url in pak works fine too:

root@38f66f676192:/# R --quiet --vanilla -e "pak::pkg_install('url::https://packagemanager.posit.co/cran/latest/bin/linux/noble-x86_64/4.5/src/contrib/Boom_0.9.16.tar.gz')"
> pak::pkg_install('url::https://packagemanager.posit.co/cran/latest/bin/linux/noble-x86_64/4.5/src/contrib/Boom_0.9.16.tar.gz')
✔ Updated metadata database: 2.97 MB in 2 files.
✔ Updating metadata database ... done

→ Will install 1 package.
→ Will download 1 package with unknown size.
+ Boom   0.9.16 [cmp][dl] + ✔ make
✔ All system requirements are already installed.

ℹ Getting 1 pkg with unknown size
✔ Cached copy of Boom 0.9.16 (x86_64-pc-linux-gnu) is the latest build
✔ Installed Boom 0.9.16  (3.9s)
✔ 1 pkg + 1 dep: kept 1, added 1 [37.9s]

jjjermiah avatar Nov 24 '25 02:11 jjjermiah