You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在RStudio中安装bdc包后无法加载的技术求助

解决bdc包加载失败的问题

问题详情

我在RStudio中成功安装了用于生物多样性数据清洗的bdc包,但调用library(bdc)加载时出现错误。相关信息如下:

bdc安装及加载错误日志

> install.packages("bdc")
trying URL 'https://cran.rstudio.com/bin/macosx/big-sur-arm64/contrib/4.3/bdc_1.1.5.tgz'
Content type 'application/x-gzip' length 806683 bytes (787 KB)
==================================================
downloaded 787 KB


The downloaded binary packages are in
    /var/folders/jp/gz36r4cd223cntlnmc2s276m0000gn/T//Rtmpq6rW8Z/downloaded_packages
> library(bdc)
Error: package or namespace load failed for ‘bdc’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/stringfish/libs/stringfish.so':
  dlopen(/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/stringfish/libs/stringfish.so, 0x0006): symbol not found in flat namespace '__ZN12RcppParallel14tbbParallelForEmmRNS_6WorkerEmi'
In addition: Warning message:
package ‘bdc’ was built under R version 4.3.3 

.libPaths()输出

.libPaths()
[1] "/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library"

sessionInfo()输出

R version 4.3.2 (2023-10-31)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Sonoma 14.6.1

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: Asia/Singapore
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] DescTools_0.99.58   openxlsx_4.2.7.1    magrittr_2.0.3      plyr_1.8.9         
 [5] taxize_0.9.102      taxizedb_0.3.1      rredlist_1.0.0.9000 U.Taxonstand_1.2.9 
 [9] lubridate_1.9.4     forcats_1.0.0       stringr_1.5.1       purrr_1.0.2        
[13] readr_2.1.5         tibble_3.2.1        ggplot2_3.5.1       tidyverse_2.0.0    
[17] tidyr_1.3.1         dplyr_1.1.4         installr_0.23.4    

loaded via a namespace (and not attached):
  [1] rstudioapi_0.17.1       jsonlite_1.8.9          CoordinateCleaner_3.0.1
  [4] fs_1.6.5                vctrs_0.6.5             memoise_2.0.1          
  [7] hoardr_0.5.4            solrium_1.2.0           ritis_1.0.0            
 [10] terra_1.8-10            htmltools_0.5.8.1       usethis_3.0.0          
 [13] haven_2.5.4             curl_6.2.0.9000         cellranger_1.1.0       
 [16] KernSmooth_2.23-22      htmlwidgets_1.6.4       rootSolve_1.8.2.4      
 [19] zoo_1.8-12              cachem_1.1.0            whisker_0.4.1          
 [22] mime_0.12               lifecycle_1.0.4         iterators_1.0.14       
 [25] pkgconfig_2.0.3         Matrix_1.6-5            R6_2.5.1               
 [28] fastmap_1.2.0           shiny_1.8.0             digest_0.6.37          
 [31] Exact_3.3               colorspace_2.1-1        rprojroot_2.0.4        
 [34] pkgload_1.3.4           RSQLite_2.3.9           urltools_1.7.3         
 [37] timechange_0.3.0        httr_1.4.7              compiler_4.3.2         
 [40] here_1.0.1              proxy_0.4-27            remotes_2.5.0          
 [43] bit64_4.6.0-1           withr_3.0.2             DBI_1.2.3              
 [46] pkgbuild_1.4.3          MASS_7.3-60             rappdirs_0.3.3         
 [49] sessioninfo_1.2.2       classInt_0.4-11         gld_2.6.6              
 [52] oai_0.4.0               tools_4.3.2             units_0.8-5            
 [55] ape_5.8-1               zip_2.3.1               httpuv_1.6.15          
 [58] rgbif_3.8.1             glue_1.8.0              nlme_3.1-164           
 [61] promises_1.3.2          grid_4.3.2              sf_1.0-19              
 [64] generics_0.1.3          gtable_0.3.6            tzdb_0.4.0             
 [67] class_7.3-22            data.table_1.16.4       lmom_3.2               
 [70] RApiSerialize_0.1.4     hms_1.1.3               sp_2.1-4               
 [73] xml2_1.3.6              foreach_1.5.2           pillar_1.10.1          
 [76] later_1.4.1             lattice_0.21-9          bit_4.5.0.1            
 [79] tidyselect_1.2.1        miniUI_0.1.1.1          pbapply_1.7-2          
 [82] crul_1.5.0              expm_1.0-0              devtools_2.4.5         
 [85] DT_0.33                 stringi_1.8.4           lazyeval_0.2.2         
 [88] boot_1.3-28.1           codetools_0.2-19        httpcode_0.3.0         
 [91] cli_3.6.3               RcppParallel_5.1.9      xtable_1.8-4           
 [94] munsell_0.5.1           readxl_1.4.3            Rcpp_1.0.14            
 [97] rnaturalearth_1.0.1     triebeard_0.4.1         dbplyr_2.5.0           
[100] parallel_4.3.2          ellipsis_0.3.2          blob_1.2.4             
[103] profvis_0.4.0           urlchecker_1.0.1        mvtnorm_1.2-4          
[106] scales_1.3.0            e1071_1.7-16            crayon_1.5.3           
[109] geosphere_1.5-20        rlang_1.1.4

已尝试操作:重新安装stringfish包

> install.packages("stringfish")
trying URL 'https://cran.rstudio.com/bin/macosx/big-sur-arm64/contrib/4.3/stringfish_0.16.0.tgz'
Content type 'application/x-gzip' length 1231643 bytes (1.2 MB)
==================================================
downloaded 1.2 MB


The downloaded binary packages are in
    /var/folders/jp/gz36r4cd223cntlnmc2s276m0000gn/T//RtmpB5IHBS/downloaded_packages

解决方案

  • 升级R版本至4.3.3
    错误提示明确指出bdc包是基于R 4.3.3构建的,当前使用的R 4.3.2版本不兼容是核心诱因之一。升级R到对应版本后,重新安装bdc及其所有依赖。

  • 从源码编译安装stringfish包
    预编译的binary包可能存在架构或依赖版本不匹配问题,尝试从源码编译:

    install.packages("stringfish", type = "source")
    

    注意:编译需要Xcode Command Line Tools,若未安装,在终端运行xcode-select --install完成安装。

  • 重新安装bdc并强制更新所有依赖
    先卸载现有bdc包,再重新安装并确保所有依赖都更新到兼容版本:

    remove.packages("bdc")
    install.packages("bdc", dependencies = TRUE)
    
  • 修复RcppParallel依赖
    错误中缺失的符号属于RcppParallel库,重新安装该库后再尝试加载bdc:

    install.packages("RcppParallel")
    

内容的提问来源于stack exchange,提问作者nootnoot

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.14 17:28:10