在 Mac OsX 10.5.8 上安装 rjags 和 JAGS 时出现问题

发布于 2024-10-20 01:26:07 字数 1230 浏览 1 评论 0原文

我在获取 rjags R 包以供 R 调用 JAGS 时遇到问题(只是另一个 Gibbs Sampler http://www-ice.iarc.fr/~martyn/software/jags/)。

我正在运行 Mac Os X.10.5.8 Leopard 并使用 R64 2.12.1。我从命令行编译了 JAGS。然后我在 R 命令行中安装了 rjags。

安装.packages(rjags)

当我尝试在 R 中调用 rjags 时,出现以下错误。

> library(rjags)
  Error : .onLoad failed in loadNamespace() for 'rjags', details:
  call: dyn.load(file, DLLpath = DLLpath, ...)
  error: unable to load shared object '/Library/Frameworks/R.framework/Versions/2.12/Resources   /library/rjags/libs/x86_64/rjags.so':
  dlopen(/Library/Frameworks/R.framework/Versions/2.12/Resources/library/rjags/libs/x86_64/rjags.so, 10): Library not loaded: /usr/local/lib/libjags.2.dylib
  Referenced from: /Library/Frameworks/R.framework/Versions/2.12/Resources/library/rjags/libs/x86_64/rjags.so
  Reason: no suitable image found.  Did find:
  /usr/local/lib/libjags.2.dylib: mach-o, but wrong architecture
  /usr/local/lib/libjags.2.dylib: mach-o, but wrong architecture
  Error: package/namespace load failed for 'rjags'

我猜测 rjags 引用库中的未知文件存在一些问题,但我不确定。我在命令行方面是一个相当新手,并且对目录很感兴趣,所以任何帮助将不胜感激。

I am having issues getting rjags the R package for R to call JAGS (Just Another Gibbs Sampler http://www-ice.iarc.fr/~martyn/software/jags/ ).

I am running Mac Os X. 10.5.8 Leopard and using R64 2.12.1. I compiled JAGS from the command line. Then I installed rjags in the R command line.

install.packages(rjags)

When I try to call rjags within R, I get the following error.

> library(rjags)
  Error : .onLoad failed in loadNamespace() for 'rjags', details:
  call: dyn.load(file, DLLpath = DLLpath, ...)
  error: unable to load shared object '/Library/Frameworks/R.framework/Versions/2.12/Resources   /library/rjags/libs/x86_64/rjags.so':
  dlopen(/Library/Frameworks/R.framework/Versions/2.12/Resources/library/rjags/libs/x86_64/rjags.so, 10): Library not loaded: /usr/local/lib/libjags.2.dylib
  Referenced from: /Library/Frameworks/R.framework/Versions/2.12/Resources/library/rjags/libs/x86_64/rjags.so
  Reason: no suitable image found.  Did find:
  /usr/local/lib/libjags.2.dylib: mach-o, but wrong architecture
  /usr/local/lib/libjags.2.dylib: mach-o, but wrong architecture
  Error: package/namespace load failed for 'rjags'

I am guessing there is some issue with rjags referencing an unknown file in the library, but I am not sure. I am a fairly novice at the command line and messing around with directories, so any help would be much appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

勿忘心安 2024-10-27 01:26:07

我发现(从 SourceForge 下载并安装 dmg 后)以下命令适用我:

wget http://cran.r-project.org/src/contrib/rjags_2.2.0-4.tar.gz
wget http://cran.r-project.org/src/contrib/R2jags_0.02-15.tar.gz
sudo R --with-jags-modules=/usr/local/lib/JAGS/modules-2.2.0 CMD INSTALL rjags_2.2.0-4.tar.gz
sudo R --with-jags-modules=/usr/local/lib/JAGS/modules-2.2.0 CMD INSTALL R2jags_0.02-15.tar.gz
sudo R --with-jags-modules=/usr/local/lib/JAGS/modules-2.2.0 --arch=i386 CMD INSTALL rjags_2.2.0-4.tar.gz
sudo R --with-jags-modules=/usr/local/lib/JAGS/modules-2.2.0 --arch=x86_64 CMD INSTALL rjags_2.2.0-4.tar.gz

它们当然不是全部必要,但它们已经足够了!

I found (after downloading and installing the dmg from SourceForge) that the following commands worked for me:

wget http://cran.r-project.org/src/contrib/rjags_2.2.0-4.tar.gz
wget http://cran.r-project.org/src/contrib/R2jags_0.02-15.tar.gz
sudo R --with-jags-modules=/usr/local/lib/JAGS/modules-2.2.0 CMD INSTALL rjags_2.2.0-4.tar.gz
sudo R --with-jags-modules=/usr/local/lib/JAGS/modules-2.2.0 CMD INSTALL R2jags_0.02-15.tar.gz
sudo R --with-jags-modules=/usr/local/lib/JAGS/modules-2.2.0 --arch=i386 CMD INSTALL rjags_2.2.0-4.tar.gz
sudo R --with-jags-modules=/usr/local/lib/JAGS/modules-2.2.0 --arch=x86_64 CMD INSTALL rjags_2.2.0-4.tar.gz

They certainly aren't all necessary, but they were sufficient!

故事未完 2024-10-27 01:26:07

我在运行 Rstudio 0.97.237 和 R 2.15.2 时遇到了同样的问题。这个问题与 JAGS 有关。

修复方法:从此处下载并安装 JAGS 3-3,更新至 JAGS 3-3。

I had the same problem while running Rstudio 0.97.237 and R 2.15.2. The issue had something to do with JAGS.

The fix: Update to JAGS 3-3 by downloading and installing it from here.

只是我以为 2024-10-27 01:26:07

我遇到了错误:无法加载共享对象 '/Library/Frameworks/R.framework/Resources/modules//R_X11.so': 在我的 Mac 上,DuckDuckGo 让我看到了这篇文章。我是从命令行使用 R 的,所以我无法谈论它如何与 RStudio 一起工作,尽管我很确定它也可以解决这个问题。我从另一个答案中提供的 SourceForge 链接更新了 JAGS。我至少可以验证它是否对我有用,尽管开发人员未签名(我需要在安装过程中忽略 MacOS 警告)。

I encountered the error: unable to load shared object '/Library/Frameworks/R.framework/Resources/modules//R_X11.so': on my Mac and DuckDuckGo led me to this post. I was using R from the command line, so I can't speak to how it works with RStudio although I'm pretty sure it's the fix for that too. I updated JAGS from the SourceForge link provided in another answer. I can at least verify that it worked for me, though the developer was unsigned (I needed to ignore a MacOS warning during the installation procedure).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文