【问题标题】:OS X clang rpy2OS X 铿锵声rpy2
【发布时间】:2017-09-08 12:02:10
【问题描述】:

我正在尝试使用 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

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

更新: 我尝试通过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

你知道怎么设置吗?这可能是它失败的原因

【问题讨论】:

  • OMP 是OpenMP library。您的 clang(Apple 的分支)似乎不支持它(我可以用我的 LLVM 7.0 重现此问题,尽管消息略有不同)。根据我能找到的,你可能想试试brew install llvm
  • 我已经做到了,但没有运气。顺便说一句,我的 clang 不应该是我的苹果(xcode)版本,而是我在链接 thecoatlessprofessor.com/programming/openmp-in-r-on-os-x/… 中找到的另一个版本
  • 对,我看错了版本行。无论如何,问题在于您的编译器无法找到 OpenMP。它需要重新安装,配置为支持 OpenMP。不幸的是,我不知道该怎么做(我自己的安装也是类似的)。

标签: r macos python-3.x clang


【解决方案1】:

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

请注意,问题已解决,并且 rpy2-2.9.3 的预编译二进制轮现在可在 pypi 上使用。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-10-24
    • 1970-01-01
    • 2012-01-08
    • 2012-07-08
    • 1970-01-01
    • 2018-06-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多