Error installing package in R Studio on Mac: dyn.load(file, DLLpath = DLLpath, ...)

Hello all. I'm having difficulty loading the Causal Impact library on R Studio on my laptop. As context, I'm using:

  • Macbook Pro with an M3 Pro chip and 36 GB memory

  • macOS Sonoma 14.7

  • R 4.4.1, R Studio 2024.09.0+375.

Here are my code and the results of each line:

install.packages("CausalImpact")

The following package(s) will be installed:
- CausalImpact [1.3.0]
These packages will be installed into "~/Documents/R/Projects/renv/library/macos/R-4.4/aarch64-apple-darwin20".

Do you want to proceed? [Y/n]: Y

# Installing packages --------------------------------------------------------
- Installing CausalImpact ...                   OK [linked from cache]
Successfully installed 1 package in 17 milliseconds.

library(CausalImpact)

Loading required package: bsts
Loading required package: BoomSpikeSlab
Loading required package: Boom

Attaching package: ‘Boom’

The following object is masked from ‘package:stats’:

    rWishart

Error: package or namespace load failed for ‘BoomSpikeSlab’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/Users/JaimeColmenares/Library/Caches/org.R-project.R/R/renv/cache/v5/macos/R-4.4/aarch64-apple-darwin20/BoomSpikeSlab/1.2.6/65246c474323d25ac2357fa3bf40174b/BoomSpikeSlab/libs/BoomSpikeSlab.so':
  dlopen(/Users/JaimeColmenares/Library/Caches/org.R-project.R/R/renv/cache/v5/macos/R-4.4/aarch64-apple-darwin20/BoomSpikeSlab/1.2.6/65246c474323d25ac2357fa3bf40174b/BoomSpikeSlab/libs/BoomSpikeSlab.so, 0x0006): symbol not found in flat namespace '__ZN4BOOM9GlobalRng3rngE'
Error: package ‘BoomSpikeSlab’ could not be loaded

How can I resolve this? Thanks in advance!!

Seems like you have a broken installation of the BoomSpikeSlab package, possibly some of its system dependencies are missing. Try to reinstall BoomSpikeSlab first.

Hi Gabor, thanks for being willing to help!

I tried the following and neither resolved the problem:

  • updating the BoomSpikeSlab package
  • removing and installing BoomSpikeSlab again

Any other ideas on how I can resolve this?

Seems like you are compiling packages from source. When you do that on macOS, you'll need to install their required system packages.

But this error seems more like a system incompatibility than a system error. First I would try to install it without renv, to see if the issue is renv-specific.