Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problem with drat package libraries #1254

Closed
tjmahr opened this issue May 12, 2023 · 4 comments
Closed

problem with drat package libraries #1254

tjmahr opened this issue May 12, 2023 · 4 comments
Labels
bug an unexpected problem or unintended behavior install 🧺

Comments

@tjmahr
Copy link

tjmahr commented May 12, 2023

The Stan teams puts some packages in an R package repository https://mc-stan.org/r-packages/ and it appears to created using drat. renv::install() seems to search for a file on this repository, fails and throws an error. Regular install.packages() just throws a warning in this case.

options(
  repos = c(
    stan = "https://mc-stan.org/r-packages/",
    getOption("repos")
  )
)
renv::install("cmdstanr")
#> Warning in value[[3L]](cond): restarting interrupted promise evaluation
#> Error: error downloading 'https://mc-stan.org/r-packages/bin/windows/contrib/4.3/PACKAGES.rds' [curl: (22) The requested URL returned error: 404]

install.packages("cmdstanr")
#> Installing package into 'C:/Users/Tristan/Documents/.renv/library/2021-10-hl-vss-1f875583/R-4.3/x86_64-w64-mingw32'
#> (as 'lib' is unspecified)
#> also installing the dependencies 'gtable', 'isoband', 'numDeriv', 'ggplot2', 'abind', 'tensorA', 'distributional', 'matrixStats', 'checkmate', 'posterior'
#> Warning: unable to access index for repository https://mc-stan.org/r-packages/bin/windows/contrib/4.3:
#>   cannot open URL 'https://mc-stan.org/r-packages/bin/windows/contrib/4.3/PACKAGES'
#> package 'gtable' successfully unpacked and MD5 sums checked
#> package 'isoband' successfully unpacked and MD5 sums checked
#> package 'numDeriv' successfully unpacked and MD5 sums checked
#> package 'ggplot2' successfully unpacked and MD5 sums checked
#> package 'abind' successfully unpacked and MD5 sums checked
#> package 'tensorA' successfully unpacked and MD5 sums checked
#> package 'distributional' successfully unpacked and MD5 sums checked
#> package 'matrixStats' successfully unpacked and MD5 sums checked
#> package 'checkmate' successfully unpacked and MD5 sums checked
#> package 'posterior' successfully unpacked and MD5 sums checked
#> 
#> The downloaded binary packages are in
#>  C:\Users\Tristan\AppData\Local\Temp\Rtmp0cWazJ\downloaded_packages
#> #> installing the source package 'cmdstanr'

Created on 2023-05-12 with reprex v2.0.2

@tjmahr
Copy link
Author

tjmahr commented May 12, 2023

Here is the same reprex but with the shim blocked to remove ambiguity.

options(
  repos = c(
    stan = "https://mc-stan.org/r-packages/",
    getOption("repos")
  )
)
renv::install("cmdstanr")
#> Warning in value[[3L]](cond): restarting interrupted promise evaluation

#> Warning in value[[3L]](cond): restarting interrupted promise evaluation
#> Error: error downloading 'https://mc-stan.org/r-packages/bin/windows/contrib/4.3/PACKAGES.rds' [curl: (22) The requested URL returned error: 404]

utils::install.packages("cmdstanr")
#> Installing package into 'C:/Users/Tristan/Documents/.renv/library/2021-10-hl-vss-1f875583/R-4.3/x86_64-w64-mingw32'
#> (as 'lib' is unspecified)
#> Warning: unable to access index for repository https://mc-stan.org/r-packages/bin/windows/contrib/4.3:
#>   cannot open URL 'https://mc-stan.org/r-packages/bin/windows/contrib/4.3/PACKAGES'
#> installing the source package 'cmdstanr'

Created on 2023-05-12 with reprex v2.0.2

@hadley
Copy link
Member

hadley commented May 12, 2023

I think a minimal reprex should be this:

renv::install("cmdstanr", repos = "https://mc-stan.org/r-packages/")

(But that works for me, presumably because I'm on 4.2 which has binaries). I'm guessing that this is because stan hasn't built windows binaries for 4.3 yet.

@hadley hadley added bug an unexpected problem or unintended behavior install 🧺 labels May 12, 2023
@tjmahr
Copy link
Author

tjmahr commented May 12, 2023

Ahh thanks! I've let stan-dev know. stan-dev/r-packages#10

@hadley
Copy link
Member

hadley commented Jun 8, 2023

Looks like it's been fixed at their end:

tmp <- tempfile()
dir.create(tmp)
setwd(tmp)

options(
  repos = c(
    stan = "https://mc-stan.org/r-packages/",
    getOption("repos")
  )
)
renv::install("cmdstanr")
#> # Downloading packages -------------------------------------------------------
#> Retrieving 'https://mc-stan.org/r-packages/bin/macosx/big-sur-arm64/contrib/4.2/cmdstanr_0.5.3.tgz' ...
#>  OK [downloaded 1.1 Mb in 0.46 seconds]
#> 
#> # Installing packages into "~/Library/R/arm64/4.2/library" -------------------
#> The following package(s) will be installed:
#> 
#> - cmdstanr [0.5.3]
#> 
#> Installing cmdstanr ... OK [installed binary]
#> Caching    cmdstanr ... OK [copied]
#> Installed 1 package in 2.2 seconds.

Created on 2023-06-08 with reprex v2.0.2

It's possible that there's some renv bug here too, but that's going to be hard to run down now that we don't have a reprex.

@hadley hadley closed this as completed Jun 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior install 🧺
Projects
None yet
Development

No branches or pull requests

2 participants