无法使用Revolution R Open 3.2.2在macOS上安装package psych

时间:2016-12-17 11:21:30

标签: r macos gfortran install.packages microsoft-r

我尝试使用Revolution R Open 3.2.2在macOS上安装mental包。我使用install.packages("psych")并且将下载所有依赖项。 第一个依赖项已成功解压缩。

之后会发生以下情况:

gfortran -arch x86_64   -fPIC  -g -O2  -c biv-nt.f -o biv-nt.o

gfortran -arch x86_64   -fPIC  -g -O2  -c sadmvnt.f -o sadmvnt.o

clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/Users/Shared/Jenkins/workspace/External-R-3.3.2/vendor/build/lib -o mnormt.so biv-nt.o sadmvnt.o -L/usr/local/lib/gcc/i686-apple-darwin8/4.2.3/x86_64 -L/usr/local/lib/x86_64 -L/usr/local/lib/gcc/i686-apple-darwin8/4.2.3 -L/usr/local/lib -lgfortran -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation

ld: warning: directory not found for option '-L/Users/Shared/Jenkins/workspace/External-R-3.3.2/vendor/build/lib'

ld: warning: directory not found for option '-L/usr/local/lib/gcc/i686-apple-darwin8/4.2.3/x86_64'

ld: warning: directory not found for option '-L/usr/local/lib/x86_64'

ld: warning: directory not found for option '-L/usr/local/lib/gcc/i686-apple-darwin8/4.2.3'

ld: library not found for -lgfortran

clang: error: linker command failed with exit code 1 (use -v to see invocation)

make: *** [mnormt.so] Error 1

ERROR: compilation failed for package ‘mnormt’

* removing ‘/Users/sebastian/Library/R/3.3/library/mnormt’

Warning in install.packages :
  installation of package ‘mnormt’ had non-zero exit status

ERROR: dependency ‘mnormt’ is not available for package ‘psych’

* removing ‘/Users/sebastian/Library/R/3.3/library/psych’

Warning in install.packages :

  installation of package ‘psych’ had non-zero exit status

The downloaded source packages are in

  /private/var/folders/8d/tdsm42091lz926w1q2lx77c40000gn/T/RtmpHxWPQe/downloaded_packages

我的系统:

R version 3.3.2 (2016-10-31)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.1

其他包也会发生这种情况,但并非所有包都发生。我安装了ggplot2,dplyr或者tidyr,一切都运行正常。

2 个答案:

答案 0 :(得分:4)

当我在MRO切换到MacOS时,我遇到了与其他许多R套餐相同的问题。这可能是两件事:

  1. 您缺少gfortran,例如评论中提到的@hrbrmstr。
  2. 或者,您有gfortran,但编译器未指定链接库路径,因为您可以在错误消息中看到它在gfortran行中消失之前。
  3. 2对我有用的解决方案是编辑~/.R/Makevars以添加您的GCC/GFortran库。对于GCC5

    LDFLAGS=-L/usr/local/lib/gcc/5

答案 1 :(得分:2)

单独安装gfortran在我的情况下没有帮助。确保已安装XCode并进行更新。这帮助了我。