OS X铿锵rpy2

时间:2017-09-08 12:02:10

标签: r macos python-3.x clang

我正在尝试使用R 3.4在OS X(El Capitan)中安装python库rpy2。 我确实在网上关注了很多帖子,最后我将clang从xcode替换为手动安装的一个(在跟随http://thecoatlessprofessor.com/programming/openmp-in-r-on-os-x/#clang-before-3-4-0之后):

clang version 4.0.0 (tags/RELEASE_400/final)
Target: x86_64-apple-darwin15.5.0
Thread model: posix
InstalledDir: /usr/bin

但是,当我尝试安装rpy2(sudo pip3 install rpy2)时:

clang -bundle -undefined dynamic_lookup build/temp.macosx-10.11-x86_64-3.6/./rpy/rinterface/_rinterface.o -L/usr/local/lib -L/usr/local/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/sqlite/lib -Lbuild/temp.macosx-10.11-x86_64-3.6 -L/usr/local/lib -lpcre -llzma -lbz2 -lz -licucore -lm -liconv -lr_utils -o build/lib.macosx-10.11-x86_64-3.6/rpy2/rinterface/_rinterface.cpython-36m-darwin.so -fopenmp -F/Library/Frameworks/R.framework/.. -framework R
    ld: library not found for -lomp
    clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation)
    error: command 'clang' failed with exit status 1

什么是lomp?我不确定我现在能做什么。

更新: 我尝试通过brew重新安装llvm:

brew reinstall --with-clang --with-lld --with-python --HEAD llvm

现在安装rpy2我得到了:

clang -bundle -undefined dynamic_lookup build/temp.macosx-10.11-x86_64-3.6/./rpy/rinterface/_rinterface.o -L/usr/local/lib -L/usr/local/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/sqlite/lib -Lbuild/temp.macosx-10.11-x86_64-3.6 -L/usr/local/lib -lpcre -llzma -lbz2 -lz -licucore -lm -liconv -lr_utils -o build/lib.macosx-10.11-x86_64-3.6/rpy2/rinterface/_rinterface.cpython-36m-darwin.so -fopenmp -F/Library/Frameworks/R.framework/.. -framework R
    ld: library not found for -lomp
    clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation)
    error: command 'clang' failed with exit status 1

虽然从llvm安装我得到了建议:

For compilers to find this software you may need to set:
    LDFLAGS:  -L/usr/local/opt/llvm/lib
    CPPFLAGS: -I/usr/local/opt/llvm/include
你知道怎么设置吗?这可能是它失败的原因

1 个答案:

答案 0 :(得分:0)

这是在rpy2问题跟踪器上讨论的:https://bitbucket.org/rpy2/rpy2/issues/403/cannot-pip-install-rpy2-with-latest-r-340

请注意,问题已解决,现在可以在pypi上找到rpy2-2.9.3的预编译二进制轮。