【问题标题】:Error: clang-10: error: linker command failed with exit code 1 || Installing Rattle on Anaconda Environment with Python and R fails错误:clang-10:错误:链接器命令失败,退出代码为 1 ||使用 Python 和 R 在 Anaconda 环境中安装 Rattle 失败
【发布时间】:2021-06-03 23:24:33
【问题描述】:

直到几天前,当我弄乱了软件包并不得不删除环境时,我确实已经在我的 Conda 环境上完美地运行了 R。现在我正在尝试重新创建我的环境,但一切都不再正常了。

须知:

操作系统:MacOS BigSur

Conda 环境包含:Python 3.8 和 R 3.6.1

> version
               _                           
platform       x86_64-apple-darwin13.4.0   
arch           x86_64                      
os             darwin13.4.0                
system         x86_64, darwin13.4.0        
status                                     
major          3                           
minor          6.1                         
year           2019                        
month          07                          
day            05                          
svn rev        76782                       
language       R                           
version.string R version 3.6.1 (2019-07-05)
nickname       Action of the Toes   

which R 命令显示路径为thegeorgejoseph/anaconda/envs/protonaml/bin/R

.libPaths() 显示为thegeorgejoseph/anaconda/envs/protonaml/lib/R/library

为什么它们不同?这可能是问题的原因吗?

当我尝试安装拨浪鼓时,它运行了几次然后失败说tibblerlang 和其他几个无法安装的软件包。当我在 R 上运行 install.packages(rlang) 命令时,我得到以下回溯。 任何帮助表示赞赏,可能出了什么问题?

 install.packages('rlang')
trying URL 'https://cloud.r-project.org/src/contrib/rlang_0.4.10.tar.gz'
Content type 'application/x-gzip' length 915685 bytes (894 KB)
==================================================
downloaded 894 KB

* installing *source* package ‘rlang’ ...
** package ‘rlang’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
x86_64-apple-darwin13.4.0-clang -I"/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml/lib/R/include" -DNDEBUG -I./lib/  -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9  -I/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml/include  -fPIC  -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -I/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml/include -fdebug-prefix-map=/opt/concourse/worker/volumes/live/59b7f007-fada-42cf-7435-5bbd0518eaa4/volume/r-base_1570124919999/work=/usr/local/src/conda/r-base-3.6.1 -fdebug-prefix-map=/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml=/usr/local/src/conda-prefix  -c capture.c -o capture.o
x86_64-apple-darwin13.4.0-clang -I"/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml/lib/R/include" -DNDEBUG -I./lib/  -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9  -I/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml/include  -fPIC  -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -I/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml/include -fdebug-prefix-map=/opt/concourse/worker/volumes/live/59b7f007-fada-42cf-7435-5bbd0518eaa4/volume/r-base_1570124919999/work=/usr/local/src/conda/r-base-3.6.1 -fdebug-prefix-map=/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml=/usr/local/src/conda-prefix  -c export.c -o export.o
x86_64-apple-darwin13.4.0-clang -I"/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml/lib/R/include" -DNDEBUG -I./lib/  -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9  -I/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml/include  -fPIC  -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -I/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml/include -fdebug-prefix-map=/opt/concourse/worker/volumes/live/59b7f007-fada-42cf-7435-5bbd0518eaa4/volume/r-base_1570124919999/work=/usr/local/src/conda/r-base-3.6.1 -fdebug-prefix-map=/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml=/usr/local/src/conda-prefix  -c internal.c -o internal.o
x86_64-apple-darwin13.4.0-clang -I"/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml/lib/R/include" -DNDEBUG -I./lib/  -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9  -I/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml/include  -fPIC  -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -I/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml/include -fdebug-prefix-map=/opt/concourse/worker/volumes/live/59b7f007-fada-42cf-7435-5bbd0518eaa4/volume/r-base_1570124919999/work=/usr/local/src/conda/r-base-3.6.1 -fdebug-prefix-map=/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml=/usr/local/src/conda-prefix  -c lib.c -o lib.o
x86_64-apple-darwin13.4.0-clang -I"/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml/lib/R/include" -DNDEBUG -I./lib/  -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9  -I/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml/include  -fPIC  -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -I/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml/include -fdebug-prefix-map=/opt/concourse/worker/volumes/live/59b7f007-fada-42cf-7435-5bbd0518eaa4/volume/r-base_1570124919999/work=/usr/local/src/conda/r-base-3.6.1 -fdebug-prefix-map=/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml=/usr/local/src/conda-prefix  -c version.c -o version.o
x86_64-apple-darwin13.4.0-clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml/lib/R/lib -Wl,-dead_strip_dylibs -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml/lib -L/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml/lib -o rlang.dylib capture.o export.o internal.o lib.o version.o -L/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml/lib/R/lib -lR -Wl,-framework -Wl,CoreFoundation
ld: warning: -pie being ignored. It is only used when linking a main executable
ld: unsupported tapi file type '!tapi-tbd' in YAML file '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks//CoreFoundation.framework/CoreFoundation.tbd' for architecture x86_64
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml/lib/R/share/make/shlib.mk:6: rlang.dylib] Error 1
ERROR: compilation failed for package ‘rlang’
* removing ‘/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml/lib/R/library/rlang’

PS:我也尝试将 Rstudio 安装到环境中,但使用 install.packages() 命令时遇到了同样的错误。 但是,在创建新环境并使用 Anaconda 的 R 通道安装我需要的每个包时,安装成功并且不会引发任何错误,但我仍然无法使用 library(rattle) 在脚本中加载库。

【问题讨论】:

  • 不要通过 Conda 安装 Rstudio - 只有旧版本,而且你不想在每个环境中都安装一个巨大的 IDE。在系统或用户级别安装 RStudio 和launch it with the environment activated

标签: r anaconda clang conda


【解决方案1】:

which R.libPaths() 没有问题——它们应该是这样的,前者指向二进制文件,后者指向 R 包的安装位置。

至于错误,在 Conda 环境中使用 R 时,应该更喜欢使用 conda install 而不是 R 的 install.packages 来管理包。否则,动态库链接可能会出现问题。在这种情况下,请尝试

conda install -n protonaml -c conda-forge r-rattle

这对于非编译的 R 包来说不是什么问题,类似于在 Conda 环境中使用 pip 对于纯 Python 包通常很好。不过,我通常建议坚持使用conda install 以避免这些问题。请注意,conda-forge 频道有许多 CRAN 包。

【讨论】:

  • 我作为 PS 在帖子中提到如何使用 conda install rattle 安装软件包允许我下载软件包,但是,我仍然无法使用 library(rattle) 将它们加载到 rscript 中
  • @serotonin 你是如何运行 Rscript 的?从激活的环境中,还是使用conda run,或者别的什么?
  • 是的,我使用conda activate protonaml 激活环境,然后执行命令R 以启动解释器并查看是否可以在终端中使用library(rattle) 命令导入库跨度>
  • @serotonin 在执行library(rattle) 时会出现什么错误?例如,找不到包或关于 dylibs 的东西?
  • Error in library(rattle) : there is no package called ‘rattle’
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2019-08-01
  • 2018-07-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多