在 OSX 上为 R 安装 RForge 版本的 xts 包时出错 [英] Errors installing RForge version of xts package for R on OSX

查看:31
本文介绍了在 OSX 上为 R 安装 RForge 版本的 xts 包时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

CRAN 上 xts 的最新版本是 0.7-5.但是我想尝试一下吸墨纸包,为此需要 xts >= 0.7.6.17.为了获得这个最新版本,我首先从 RForge 下载了 .tgz 文件并尝试:

The latest version of xts on CRAN is 0.7-5. But I'd like to try out the blotter package, for which xts >= 0.7.6.17 is required. To get this latest version, I first I downloaded the .tgz file from RForge and tried:

[Downloads]$ R CMD INSTALL xts_0.7-6.17.tgz 
WARNING: ignoring environment value of R_HOME
* installing to library ‘/Library/Frameworks/R.framework/Resources/library’
* installing *binary* package ‘xts’ ...

* DONE (xts)

启动 R 控制台后,我输入了 require(xts) 并得到了这个:

After launching R console, I typed require(xts) and got this:

> require(xts)
Loading required package: xts
Loading required package: zoo
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
unable to load shared object '/Library/Frameworks/R.framework/Versions/2.12/Resources/library/xts/libs/x86_64/xts.so':
dlopen(/Library/Frameworks/R.framework/Versions/2.12/Resources/library/xts/libs/x86_64/xts.so, 6): Library not loaded: /usr/local/lib/libgfortran.2.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/2.12/Resources/library/xts/libs/x86_64/xts.so
Reason: image not found
In addition: Warning message:
package 'xts' was built under R version 2.12.2 

我通过下载该文件并再次运行它来恢复到 CRAN 版本:

I reverted to the CRAN version by downloading that file and running this again:

[Downloads]$ R CMD INSTALL xts_0.7-5.tgz 
WARNING: ignoring environment value of R_HOME
* installing to library ‘/Library/Frameworks/R.framework/Resources/library’
* installing *binary* package ‘xts’ ...

* DONE (xts)

打开 R 控制台并输入 require(xts):

Opening R console and typing in require(xts):

> require(xts)
Loading required package: xts
Loading required package: zoo
>

一切都很好,除了我需要 RForge 版本才能安装吸墨纸.

All is well again, except I need to RForge version to get blotter installed.

注意:我运行的是 OS X (10.6.6)

NOTE: I'm running OS X (10.6.6)

更新:一切都不好.现在我无法正确加载 CRAN xts 版本.

UPDATE: all is NOT well. Now I can't get the CRAN xts version to load properly.

更新 #2:我通过运行 install.packages("xts", repo="http://cran.r-project.org") 找回了旧的 xts.实际上,我也为quantmod"和TTR"运行了它,因为发生了各种神秘的破解.

UPDATE #2: I got my old xts back by running install.packages("xts", repo="http://cran.r-project.org"). Actually, I ran it for "quantmod" and "TTR" as well because all manner of mysterious breaking was occurring.

更新 #3:按照 Dirk 在下面评论中的建议,我尝试从 OS X 上的源代码编译并遇到了

UPDATE #3: Following Dirk's recommendation in comments below, I've attempted to compile from source on OS X and was met with

make: gfortran: No such file or directory

所以从 http://www.macresearch.org/xcode_gfortran_plugin_update 的链接安装后,我'我现在面临一个抱怨 -arch 标志的新错误:

So after installing from the link at http://www.macresearch.org/xcode_gfortran_plugin_update, I'm now faced with a new error complaining about the -arch flag:

gfortran -arch i386   -fPIC  -g -O2 -c period.max.f -o period.max.o
f951: error: unrecognized command line option "-arch"

更新 #4:我在更新 #3 中安装了错误的 Fortran 编译器.不要将该编译器用于 R 包.

UPDATE #4: I installed the wrong fortran compiler in UPDATE #3. Don't use that compiler for R packages.

推荐答案

如果您在 Mac OS X 平台上使用 R,那么最好了解从源代码安装的机制,因为 Mac 二进制文件有时制作起来很慢到存储库.R 生态系统是 Ubuntu 和 SVN.有一天它可能会变成 OS X 和 Git(我们可以希望,不是吗?)

If you are using R on the Mac OS X platform, then it's good to know the mechanics of installing from source, as Mac binaries are sometimes slow to make it to repositories. The R eco-system is Ubuntu and SVN. Someday it may morph to OS X and Git (we can hope, no?)

在开始从源代码安装之前,您需要确保已安装 Xcode.

Before you start installing from source, you need to make sure you have Xcode installed.

http://developer.apple.com/technologies/tools/xcode.html

那么你需要有一个fortran编译器,它不是Xcode自带的.好消息是,在 OS X 上有一个专门为 R 用户提供 Fortran 编译器的地方.

Then you need to have a fortran compiler, which doesn't come with Xcode. The good news is that there is a place devoted to fortran compilers on OS X for R users.

http://r.research.att.com/tools/

一旦安装和配置正确,您需要从这里从 RForge 获取 xts 的尖端版本:(感谢 Dirk)

Once this is installed and configured properly, you need to get the cutting-edge version of xts from RForge from here: (Thanks Dirk)

http://r-forge.r-project.org/src/contrib/xts_0.7-6.17.tar.gz

最后,只需从终端的命令行运行以下命令:

Finally, simply run the following from command-line in terminal:

[Downloads]$ R CMD INSTALL xts_0.7-6.17.tar.gz

注意:tar.gz 是源文件的扩展名,而 .tgz 是 Mac 二进制文件的扩展名.

NOTE: tar.gz is the extension for source files while .tgz is the extension for Mac binaries.

这篇关于在 OSX 上为 R 安装 RForge 版本的 xts 包时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆