pak
pak copied to clipboard
incompatibility with ubuntu-like operating systems
running pak::pak
to install packages results in Error: sysreqs lookup error: Bad Request (HTTP 400).
on Pop!_OS 22.04 (which is an Ubuntu derivative and should just work as expected). I've narrowed it down to the way that pkgdepends
is building an installation proposal, the url generated for querying the rstudio package manager ends up looking like https://packagemanager.rstudio.com/__api__/repos/1/sysreqs?distribution=pop&release=22.04
, which is of course an invalid url due to using distribution=pop
instead of distribution=ubuntu
. Ultimately, it looks like the problem is due to how pkgdepends
is detecting the current platform. pkgdepends
calls out to pkgcache::current_r_platform_data
which reads the file /etc/os-release
in order to get the distribution id. On Pop!_OS this looks like
NAME="Pop!_OS"
VERSION="22.04 LTS"
ID=pop
ID_LIKE="ubuntu debian"
PRETTY_NAME="Pop!_OS 22.04 LTS"
VERSION_ID="22.04"
HOME_URL="https://pop.system76.com"
SUPPORT_URL="https://support.system76.com"
BUG_REPORT_URL="https://github.com/pop-os/pop/issues"
PRIVACY_POLICY_URL="https://system76.com/privacy"
VERSION_CODENAME=jammy
UBUNTU_CODENAME=jammy
LOGO=distributor-logo-pop-os
so the distribution is showing up as pop
which is being interpolated into the url. It really should be using a combination of ID and ID_LIKE to determine if the system is ubuntu or ubuntu-like and setup the URL appropriately
Yeah, we could parse os-release better. Are these fields standardized? I remember seeing slightly different ones on another Ubuntu-derivative distro.
Btw. did you turn on system requirements installation manually? Or did you by any change use https://github.com/r-lib/rig which turned it on automatically?
Yeah, we could parse os-release better. Are these fields standardized? I remember seeing slightly different ones on another Ubuntu-derivative distro.
Yes, the os-release is standardized for distros that use systemd, ref can be found here. It looks like the recommended approach is to check ID
first, and if that isn't a recognized distro, then to look at ID_LIKE
which contains a list of distros it is related to.
Btw. did you turn on system requirements installation manually? Or did you by any change use https://github.com/r-lib/rig which turned it on automatically?
It was turned on by using rig. Is there an easy way to turn it off?
It was turned on by using rig. Is there an easy way to turn it off?
The simplest is probably to reinstall R with rig add ... --without-sysreqs
.
Or remove the Sys.setenv(PKG_SYSREQS = "true")
line from the system profile, at /opt/R/*/lib/R/library/base/R/Rprofile
Cool, that works to bypass the issue.
Does this mean Ubuntu 22.04 is not supported yet?
When using {pak} on Ubuntu 22.04 (WSL), using pak::pkg_install()
and pak::pak()
both results in following error:
pak::pkg_install("tidyverse")
#> <callr_status_error/callr_error/rlib_error_3_0/rlib_error/error>
#> Error:
#> ! error in callr subprocess
#> Caused by error in `loadNamespace(x)`:
#> ! 不存在叫‘pkgdepends’这个名字的程辑包
#> <packageNotFoundError in loadNamespace(x): 不存在叫‘pkgdepends’这个名字的程辑包>
#> NULL
#> Error: ! error in callr subprocess
#> Caused by error in `loadNamespace(x)`:
#> ! 不存在叫‘pkgdepends’这个名字的程辑包
Created on 2022-08-23 with reprex v2.0.2
Session info
sessionInfo()
#> R version 4.2.1 (2022-06-23)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Ubuntu 22.04.1 LTS
#>
#> Matrix products: default
#> BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0
#> LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0
#>
#> locale:
#> [1] LC_CTYPE=zh_CN.UTF-8 LC_NUMERIC=C
#> [3] LC_TIME=zh_CN.UTF-8 LC_COLLATE=zh_CN.UTF-8
#> [5] LC_MONETARY=zh_CN.UTF-8 LC_MESSAGES=zh_CN.UTF-8
#> [7] LC_PAPER=zh_CN.UTF-8 LC_NAME=C
#> [9] LC_ADDRESS=C LC_TELEPHONE=C
#> [11] LC_MEASUREMENT=zh_CN.UTF-8 LC_IDENTIFICATION=C
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> loaded via a namespace (and not attached):
#> [1] pak_0.3.0 withr_2.5.0 digest_0.6.29 lifecycle_1.0.1
#> [5] magrittr_2.0.3 reprex_2.0.2 evaluate_0.16 highr_0.9
#> [9] stringi_1.7.8 rlang_1.0.4 cli_3.3.0 rstudioapi_0.13
#> [13] fs_1.5.2 rmarkdown_2.15 tools_4.2.1 stringr_1.4.1
#> [17] glue_1.6.2 xfun_0.32 yaml_2.3.5 fastmap_1.1.0
#> [21] compiler_4.2.1 htmltools_0.5.3 knitr_1.39
@psychelzh that seems like a different error, so please open a new issue, and also include how you installed pak, as your pak installation seems to be broken.
This is now supported, you can set an env var or option to force a sysreqs platform, see sysreqs_platform
in the docs: https://pak.r-lib.org/reference/pak-config.html