I am trying to install the package "rjags" in R but am running into the following error:
我正在尝试在R中安装包“rjags”,但是遇到以下错误:
Loading required package: 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/3.1/Resources/library/rjags/libs/rjags.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.1/Resources/library/rjags/libs/rjags.so, 10): Symbol not found: __ZN5RangeC1ERKSt6vectorIiSaIiEES4_
Referenced from: /Library/Frameworks/R.framework/Versions/3.1/Resources/library/rjags/libs/rjags.so
Expected in: /usr/local/lib/libjags.3.dylib
in /Library/Frameworks/R.framework/Versions/3.1/Resources/library/rjags/libs/rjags.so
Error: package ‘rjags’ could not be loaded
I've installed JAGS on my Mac (running Mavericks), and I am running R-3.1.2. I've tried installing from the url using the devtools
package, as recommended by this site:
我在我的Mac电脑上安装了JAGS(运行Mavericks),我正在运行R-3.1.2。我已经尝试使用devtools包从url安装,如本网站推荐的:
install_url("http://sourceforge.net/projects/mcmc-jags/files/rjags/3/rjags_3-2.tar.gz",
args="--configure-args='--with-jags-include=/Users/casallas/homebrew/opt/jags/include/JAGS
--with-jags-lib=/Users/casallas/homebrew/opt/jags/lib'
"
)
I've also gone through the instructions on this other site , trying the different versions of JAGS and receive the same error. I'm at a loss for what to try next and am sure the solution is simple. Does anyone have any insights? Thanks so much!
我还浏览了另一个站点上的说明,尝试了不同版本的JAGS并收到相同的错误。我不知道下一步该怎么做,我确信解决办法很简单。有人有什么见解吗?非常感谢!
2 个解决方案
#1
0
I found that while I was unable to install rjags from the url, if I installed the package from source on my computer I was successful. I did this by downloading the appropriate package from here (which for me was rjags_3-14.tgz) and ran the following command:
我发现虽然我无法从url安装rjags,但是如果我在我的计算机上安装source的package,我是成功的。我从这里下载了适当的包(对我来说是rjags_3-14.tgz)并运行以下命令:
install.packages(path_to_file, repos = NULL, type="source")
#2
0
The error:
错误:
Symbol not found: __ZN5RangeC1ERKSt6vectorIiSaIiEES4_
Is (nearly) always caused by a mismatch between standard libraries between the Mavericks build of R (actually rjags) and Snow Leopard build of JAGS (or vice versa). For more info see the instructions at https://sourceforge.net/projects/mcmc-jags/files/JAGS/3.x/Mac%20OS%20X/
(几乎)总是由标准库之间的不匹配引起的。更多信息请参见https://sourceforge.net/projects/mc - jags/files/jags/3.x/mac%20os%20x/的说明
I'm guessing that compiling the package yourself from source worked because it matched the version of the standard library that JAGS is using, but this will no longer match the version that R is using (although I'm not sure if this is a major problem, it is not recommended). You would be better to match the builds of R and JAGS and use the pre-built rjags library from CRAN.
我猜想,自己从源代码编译这个包是可行的,因为它与JAGS正在使用的标准库的版本相匹配,但是这将不再与R正在使用的版本相匹配(尽管我不确定这是否是一个主要问题,但不建议这样做)。您最好匹配R和JAGS的构建,并使用CRAN预先构建的rjags库。
It is interesting that you say you have tried both builds of JAGS but I suggest trying again along these lines:
有趣的是,你说你已经尝试过这两个版本的JAGS,但我建议你再尝试一下这些:
1) Use .Platform$pkgType in R to confirm if it you are using mac.binary (SL) or mac.binary.mavericks (Mavericks) - or failing that re-install the Mavericks binary of R from CRAN
1)在R中使用. platform $pkgType来确认你使用的是mac.binary (SL)还是mac.binary。小牛队(小牛队)——或者失败,重新安装小牛队的二进制R
2) Exit R
2)退出R
3) Re-install the appropriate version of JAGS
3)重新安装合适的JAGS版本
4) Re-open R and re-install the rjags library from CRAN
4)重新打开R,从CRAN重新安装rjags库
5) Try library(rjags)
5)尝试库(rjags)
If this doesn't work can you provide more information so I can try and track down a possible problem with the JAGS builds?
如果这不起作用,你能提供更多的信息,以便我可以尝试跟踪一个可能的问题的JAGS构建吗?
Thanks,
谢谢,
Matt
马特
#1
0
I found that while I was unable to install rjags from the url, if I installed the package from source on my computer I was successful. I did this by downloading the appropriate package from here (which for me was rjags_3-14.tgz) and ran the following command:
我发现虽然我无法从url安装rjags,但是如果我在我的计算机上安装source的package,我是成功的。我从这里下载了适当的包(对我来说是rjags_3-14.tgz)并运行以下命令:
install.packages(path_to_file, repos = NULL, type="source")
#2
0
The error:
错误:
Symbol not found: __ZN5RangeC1ERKSt6vectorIiSaIiEES4_
Is (nearly) always caused by a mismatch between standard libraries between the Mavericks build of R (actually rjags) and Snow Leopard build of JAGS (or vice versa). For more info see the instructions at https://sourceforge.net/projects/mcmc-jags/files/JAGS/3.x/Mac%20OS%20X/
(几乎)总是由标准库之间的不匹配引起的。更多信息请参见https://sourceforge.net/projects/mc - jags/files/jags/3.x/mac%20os%20x/的说明
I'm guessing that compiling the package yourself from source worked because it matched the version of the standard library that JAGS is using, but this will no longer match the version that R is using (although I'm not sure if this is a major problem, it is not recommended). You would be better to match the builds of R and JAGS and use the pre-built rjags library from CRAN.
我猜想,自己从源代码编译这个包是可行的,因为它与JAGS正在使用的标准库的版本相匹配,但是这将不再与R正在使用的版本相匹配(尽管我不确定这是否是一个主要问题,但不建议这样做)。您最好匹配R和JAGS的构建,并使用CRAN预先构建的rjags库。
It is interesting that you say you have tried both builds of JAGS but I suggest trying again along these lines:
有趣的是,你说你已经尝试过这两个版本的JAGS,但我建议你再尝试一下这些:
1) Use .Platform$pkgType in R to confirm if it you are using mac.binary (SL) or mac.binary.mavericks (Mavericks) - or failing that re-install the Mavericks binary of R from CRAN
1)在R中使用. platform $pkgType来确认你使用的是mac.binary (SL)还是mac.binary。小牛队(小牛队)——或者失败,重新安装小牛队的二进制R
2) Exit R
2)退出R
3) Re-install the appropriate version of JAGS
3)重新安装合适的JAGS版本
4) Re-open R and re-install the rjags library from CRAN
4)重新打开R,从CRAN重新安装rjags库
5) Try library(rjags)
5)尝试库(rjags)
If this doesn't work can you provide more information so I can try and track down a possible problem with the JAGS builds?
如果这不起作用,你能提供更多的信息,以便我可以尝试跟踪一个可能的问题的JAGS构建吗?
Thanks,
谢谢,
Matt
马特