ITADN

Hook installation fails on non-LTS Ubuntu

#640Closedjunoslukan 创建于 2025-09-25
J
junoslukancommented
**Before filing a bug** - [x] I have installed the latest dev version of {precommit} with `remotes::install_github('lorenzwalthert/precommit')` - [x] I have installed the latest hook revisions (update with `precommit::autoupdate()`) - [x] I have installed the latest release of the upstream Python framework pre-comit as described under the [update instructions](https://lorenzwalthert.github.io/precommit/dev/articles/precommit.html#update). **Describe the bug** I am using Ubuntu 25.04, which is a non-LTS release. Officially, R and its packages [are only supported for LTS releases](https://cran.r-project.org/bin/linux/ubuntu/index.html). This is usually not a problem, but it causes the precommit hook installation to fail. The full error stack is pasted below, but the main cause of the problem is that packages are not available on Posit Package Manager for non-LTS releases. As an example consider the `V8` library: > Warning: failed to find binary for 'V8 6.0.6' in package repositories > Warning: failed to find source for 'V8 6.0.6' in package repositories > Warning: error downloading 'https://packagemanager.posit.co/cran/__linux__/plucky/2025-08-21/src/contrib/Archive/V8/V8_6.0.6.tar.gz' [error code 22] The link mentioned here does not exist (the server returns this message: "Distribution with identifier 'plucky' not supported or not enabled"), whereas [substituting plucky with noble](https://packagemanager.posit.co/cran/__linux__/noble/2025-08-21/src/contrib/Archive/V8/V8_6.0.6.tar.gz) works as expected. Note that this is not specific to this library, but happens in fact with any (not previously installed) library. I believe this stems from the way the link is constructed, in [activate.R](https://github.com/lorenzwalthert/precommit/blob/main/renv/activate.R#L843), namely taking the OS codename as one of `c("UBUNTU_CODENAME", "VERSION_CODENAME", "VERSION_ID", "BUILD_ID")`. I don't know if you aim to support non-LTS releases, but I would greatly appreciate even a workaround for this. **To Reproduce** On a non-LTS Ubuntu try to install the hook using ```shell $ pre-commit install --install-hooks pre-commit installed at .git/hooks/pre-commit [INFO] Installing environment for https://github.com/lorenzwalthert/precommit. [INFO] Once installed this environment will be reused. [INFO] This may take a few minutes... An unexpected error has occurred: CalledProcessError: command: ('/usr/bin/Rscript', '--vanilla', '/tmp/tmpx0t42eqk/script.R') return code: 1 stdout: # Bootstrapping renv 1.1.5 --------------------------------------------------- - Downloading renv ... OK - Installing renv ... OK - None of the packages recorded in the lockfile are currently installed. - Use `renv::restore()` to restore the project library. The following package(s) will be updated: # CRAN ----------------------------------------------------------------------- - codetools [* -> 0.2-20] # RSPM ----------------------------------------------------------------------- - backports [* -> 1.5.0] - brew [* -> 1.0-10] - callr [* -> 3.7.6] - cli [* -> 3.6.5] - commonmark [* -> 2.0.0] - cpp11 [* -> 0.5.2] - curl [* -> 7.0.0] - desc [* -> 1.4.3] - digest [* -> 0.6.37] - docopt [* -> 0.7.2] - evaluate [* -> 1.0.4] - fs [* -> 1.6.6] - glue [* -> 1.8.0] - here [* -> 1.0.1] - highr [* -> 0.11] - hunspell [* -> 3.0.6] - jsonlite [* -> 2.0.0] - jsonvalidate [* -> 1.5.0] - knitr [* -> 1.50] - lazyeval [* -> 0.2.2] - lifecycle [* -> 1.0.4] - lintr [* -> 3.2.0] - magrittr [* -> 2.0.3] - pkgbuild [* -> 1.4.8] - pkgload [* -> 1.4.0] - processx [* -> 3.8.6] - ps [* -> 1.9.1] - purrr [* -> 1.1.0] - R.cache [* -> 0.17.0] - R.methodsS3 [* -> 1.8.2] - R.oo [* -> 1.27.1] - R.utils [* -> 2.13.0] - R6 [* -> 2.6.1] - Rcpp [* -> 1.1.0] - renv [* -> 1.1.5] - rex [* -> 1.2.1] - rlang [* -> 1.1.6] - roxygen2 [* -> 7.3.2] - rprojroot [* -> 2.1.0] - spelling [* -> 2.3.2] - stringi [* -> 1.8.7] - stringr [* -> 1.5.1] - styler [* -> 1.10.3] - V8 [* -> 6.0.6] - vctrs [* -> 0.6.5] - withr [* -> 3.0.2] - xfun [* -> 0.53] - xml2 [* -> 1.4.0] - xmlparsedata [* -> 1.0.5] - yaml [* -> 2.3.10] # Downloading packages ------------------------------------------------------- - Downloading V8 from RSPM ... ERROR [error code 22] Traceback (most recent calls last): 8: renv::restore() 7: renv_restore_run_actions(project, diff, current, lockfile, rebuild) 6: renv_retrieve_impl(packages) 5: handler(package, renv_retrieve_impl_one(package)) 4: renv_retrieve_impl_one(package) 3: renv_retrieve_repos(record) 2: stopf("failed to retrieve package '%s'", remote) 1: stop(sprintf(fmt, ...), call. = call.) stderr: Warning: failed to find binary for 'V8 6.0.6' in package repositories Warning: failed to find source for 'V8 6.0.6' in package repositories Warning: error downloading 'https://packagemanager.posit.co/cran/__linux__/plucky/2025-08-21/src/contrib/Archive/V8/V8_6.0.6.tar.gz' [error code 22] Warning: error downloading 'https://packagemanager.posit.co/cran/__linux__/plucky/2025-08-21/src/contrib/Archive/V8/V8_6.0.6.tar.gz' [error code 22] Error: failed to retrieve package 'V8@6.0.6' Execution halted Check the log at /home/user/.cache/pre-commit/pre-commit.log ``` **Additional context** - My operating system is: > Description: Ubuntu 25.04 > Release: 25.04 > Codename: plucky
关闭于 2025-10-01 2 条评论