-
Notifications
You must be signed in to change notification settings - Fork 164
Description
I have a new laptop and recently had WSL set up with Ubuntu 24.04. I've been using Posit Package Manager in other environments with renv before and had not had issues. However, this time, after setting up based on the instructions from https://packagemanager.posit.co/client/#/repos/cran/setup, which added the following line to '~/.Rprofile',
options(repos = c(CRAN = sprintf("https://packagemanager.posit.co/cran/latest/bin/linux/noble-%s/%s", R.version["arch"], substr(getRversion(), 1, 3))))
(the expression with sprintf() returns "https://packagemanager.posit.co/cran/latest/bin/linux/noble-x86_64/4.5" in my system)
I ran into the following error when trying to install any packages when renv is activated (I just created a new folder '~/scratch/test-renv' and ran renv::init())
- Project '~/scratch/test-renv' loaded. [renv 1.1.5]
> renv::install("remotes")
renv was unable to query available packages from the following repositories:
- # https://packagemanager.posit.co/cran/latest/bin/linux/noble-x86_64/__linux__/noble/4.5/src/contrib --------
error downloading 'https://packagemanager.posit.co/cran/latest/bin/linux/noble-x86_64/__linux__/noble/4.5/src/contrib/PACKAGES.rds' [error code 22]
error downloading 'https://packagemanager.posit.co/cran/latest/bin/linux/noble-x86_64/__linux__/noble/4.5/src/contrib/PACKAGES.gz' [error code 22]
error downloading 'https://packagemanager.posit.co/cran/latest/bin/linux/noble-x86_64/__linux__/noble/4.5/src/contrib/PACKAGES' [error code 22]
Error: package 'remotes' is not available
Traceback (most recent calls last):
12: renv::install("remotes")
11: renv_retrieve_impl(packages)
10: handler(package, renv_retrieve_impl_one(package))
9: renv_retrieve_impl_one(package)
8: withCallingHandlers(renv_available_packages_latest(package),
error = function(err) stopf("package '%s' is not available",
package))
7: renv_available_packages_latest(package)
6: stopf("package '%s' is not available", package)
5: stop(sprintf(fmt, ...), call. = call.)
4: .handleSimpleError(function (err)
{
...
}, "package 'remotes' is not available", base::quote(NULL))
3: h(simpleError(msg, call))
2: stopf("package '%s' is not available", package)
1: stop(sprintf(fmt, ...), call. = call.)
But I can install packages using install.packages() when renv is not activated. I did some digging, and one possibility is that it seems the setup instructions on Posit Package Manager may have changed recently. When I looked at the '.Rprofile' file on my older computer (also on Ubuntu 24.04), the line is
options(repos = c(CRAN = "https://packagemanager.posit.co/cran/__linux__/noble/latest"))
And when I changed the line to the above in the new environment, I was able to install packages. So I wonder whether renv is currently not handling the new repos link suggested by Package Manger properly, or maybe I'm missing something. Thank you very much.
Here's a screenshot for the link suggestion from https://packagemanager.posit.co/client/#/repos/cran/setup?r_environment=other
