Cannot install cmdstanr on freshly installed macOS + RStudio

When I try to install cmdstanr, I get this:
> install.packages("cmdstanr", repos = c(" ", getOption("repos")))
Warning in install.packages :
unable to access index for repository :
cannot open URL ' '
Warning in install.packages :
package 'cmdstanr' is not available for this version of R

Should I believe the second warning?

Ok, so apparent I first needed to install cmdstan using conda. And now I’ve activated stan-env. (stan-env) Gustavos-Air-5:~ gustavolacerda$ conda list cmdstan
# packages in environment at /Users/gustavolacerda/opt/anaconda3/envs/stan-env:
# Name Version Build Channel
cmdstan 2.29.1 h775853c_0 conda-forge

But the original error is still there. Maybe Rstudio needs to connect to the python environment?

  • R version: 4.1.2 (2021-11-01)
  • Operating System: macOS Mojave 10.14.6
  • CmdStan Version: 2.29.1
  • Compiler/Toolkit: conda

The key error here is:

cannot open URL ''

Which indicates that R wasn’t able to establish a network connection to the repo. Are you working behind a corporate proxy or similar that might be causing issues?

You could also test this by seeing if you can manually download the file using:

              destfile = file.path(tempdir(), "PACKAGES"))

If the download.file call works, then I’d suggest restarting your R session and trying the install again. If it still refuses to work, then you can just install the Github version instead:

# install.packages("remotes")
1 Like