Can't (re)install Stan on macOS Monterey: "dependency ‘parallel’ is not available"

Just upgraded from Big Sur to Monterey (macOS 12.2.1). And can’t get RStan (re)installed. Per “RStan getting started,” I tried, first,

remove.packages(“rstan”)
if (file.exists(“.RData”)) file.remove(“.RData”)

And then,

Sys.setenv(DOWNLOAD_STATIC_LIBV8 = 1) # only necessary for Linux without the nodejs library / headers
install.packages(“rstan”, repos = “https://cloud.r-project.org/”, dependencies = TRUE)

Which yields the following error message:

Warning in install.packages :
dependency ‘parallel’ is not available
trying URL ‘https://cloud.r-project.org/bin/macosx/contrib/4.1/rstan_2.21.3.tgz
Content type ‘application/x-gzip’ length 24540870 bytes (23.4 MB)
==================================================
downloaded 23.4 MB

Then, when I run the suggested code to verify the installation,

example(stan_model, package = “rstan”, run.dontrun = TRUE)

I get the following:

Error: package or namespace load failed for ‘rstan’:
package ‘parallel’ does not have a namespace
Called from: value[3L]

But per this documentation, parallel has been in r-core since 2.14.0 (?). Yet, it looks like R is nonetheless complaining that it’s missing.

I tried using, instead, dependencies = FALSE:

Sys.setenv(DOWNLOAD_STATIC_LIBV8 = 1) # only necessary for Linux without the nodejs library / headers
install.packages(“rstan”, repos = “https://cloud.r-project.org/”, dependencies = FALSE)

But I still get the same error message when I run the verification code.

So I’m stuck. Suggestions?

What output do you get if you run:

install.packages("parallel")

@andrjohns, I get:

Warning in install.packages :
package ‘parallel’ is not available for this version of R
A version of this package for your version of R might be available elsewhere,
see the ideas at
R Installation and Administration

And I’m running version 4.1.2.

And if you just run:

library(parallel)

Error in library(parallel) : ‘parallel’ is not a valid installed package
Called from: library(parallel)

That suggests an issue with your R installation itself, since the parallel package is bundled as part of the install. Can you try reinstalling R and then seeing if the parallel package loads?

1 Like

@andrjohns That did it!! Many thanks for helping me out. :-)

1 Like