Package install fails with curl for Posit PPM

Hi there,

We have been using curl as our download.file.method but when we switched to using the Posit public package manager we noticed that it doesn't work. It does work with CRAN though, and libcurl works with Posit PPM. A minreprex might be:

> # Posit with curl
> install.packages(
+   "abind", 
+   repos = "https://packagemanager.posit.co/cran/latest",
+   method = "curl"
+ )
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   146  100   146    0     0     68      0  0:00:02  0:00:02 --:--:--    68
Warning in install.packages :
  error 1 in extracting from zip file
Warning in install.packages :
  cannot open compressed file 'abind/DESCRIPTION', probable reason 'No such file or directory'
Error in install.packages : cannot open the connection

> # CRAN with curl
> install.packages(
+   "abind",
+   repos = "https://cran.rstudio.com/",
+   method = "curl"
+ )
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 63771  100 63771    0     0   168k      0 --:--:-- --:--:-- --:--:--  169k
package ‘abind’ successfully unpacked and MD5 sums checked

> # Posit with libcurl
> install.packages(
+   "abind",
+   repos = "https://packagemanager.posit.co/cran/latest",
+   method = "libcurl"
+ )
trying URL 'https://packagemanager.posit.co/cran/latest/bin/windows/contrib/4.3/abind_1.4-5.zip'
Content type 'binary/octet-stream' length 64122 bytes (62 KB)
downloaded 62 KB

package ‘abind’ successfully unpacked and MD5 sums checked

Hi @Robin_NSWH,

The curl method doesn't follow HTTP redirects by default, which causes the download to fail on PPM (which isn't just a flat file system like the regular CRAN mirrors). Simple fix is to set the following option before calling install.packages():

options(download.file.extra="-L")

Then it should work.

Cheers,
Joe

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.