【问题标题】:dyld: Library not loaded: /usr/local/opt/openblas/lib/libopenblasp-r0.2.20.dylibdyld:库未加载:/usr/local/opt/openblas/lib/libopenblasp-r0.2.20.dylib
【发布时间】:2018-11-11 01:58:36
【问题描述】:

当我运行R 时,我得到:

dyld: Library not loaded: /usr/local/opt/openblas/lib/libopenblasp-r0.2.20.dylib
  Referenced from: /usr/local/Cellar/r/3.5.0_1/lib/libR.dylib
  Reason: image not found
Abort trap: 6

文件确实不存在:

ls /usr/local/opt/openblas/lib/libopenblasp-r0.2.20.dylib
ls: cannot access '/usr/local/opt/openblas/lib/libopenblasp-r0.2.20.dylib': No such file or directory

我在 macOS 10.13.3 上并使用homebrew 像这样安装 R:

# Java
brew cask install java

# OpenBLAS (installs gcc and other dependencies)
brew install openblas

# R language for statistical computing
brew install r --with-openblas --with-java

# Install XQuartz, needed for R package "Cairo"
brew cask install xquartz

# Needed for R package "RMySQL"
brew install mariadb-connector-c

# Needed for R packages: udunits2, units, ggforce
brew install udunits

【问题讨论】:

    标签: r homebrew openblas


    【解决方案1】:

    我们看看openblas的安装版本是不是0.2.20:

    brew info openblas 
    
    openblas: stable 0.3.0 (bottled), HEAD [keg-only]
    Optimized BLAS library
    https://www.openblas.net/
    /usr/local/Cellar/openblas/0.3.0 (22 files, 139MB)
      Poured from bottle on 2018-05-31 at 20:42:55
    From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/openblas.rb
    ==> Dependencies
    Required: gcc ✔
    ==> Options
    --with-openmp
            Enable parallel computations with OpenMP
    --HEAD
            Install HEAD version
    ==> Caveats
    This formula is keg-only, which means it was not symlinked into /usr/local,
    because macOS provides BLAS and LAPACK in the Accelerate framework.
    
    For compilers to find this software you may need to set:
        LDFLAGS:  -L/usr/local/opt/openblas/lib
        CPPFLAGS: -I/usr/local/opt/openblas/include
    For pkg-config to find this software you may need to set:
        PKG_CONFIG_PATH: /usr/local/opt/openblas/lib/pkgconfig
    

    我们有 0.3.0,但 R 正在寻找 0.2.20

    要解决这个问题,我们可以从已安装的 dylib 创建一个符号链接:

    ln -s /usr/local/opt/openblas/lib/libopenblas.dylib \
          /usr/local/opt/openblas/lib/libopenblasp-r0.2.20.dylib
    

    有效!

    R
    
    R version 3.5.0 (2018-04-23) -- "Joy in Playing"
    Copyright (C) 2018 The R Foundation for Statistical Computing
    Platform: x86_64-apple-darwin17.4.0 (64-bit)
    

    【讨论】:

    • 在 R 3.5.2_2 和 OpenBLAS 0.3.5 上也表现出色(尽管版本号不同)
    • 太棒了!我有同样的问题,甚至阻止在终端中运行 R。原来我的 R 版本 3.6.0 在 Mac 上期待 /usr/local/opt/openblas/lib/libopenblasp-r0.3.6.dylib,而不知何故我已经将它升级到 /usr/local/opt/openblas/ lib/libopenblasp-r0.3.7.dylib。所以我在终端中运行 ln -s /usr/local/opt/openblas/lib/libopenblas.dylib /usr/local/opt/openblas/lib/libopenblasp-r0.3.7.dylib 并且它有效。顺便说一句,这也解决了我安装包 sf 的问题。
    • 像魅力一样工作。但这是一个奇怪的解决方案。
    • 投反对票:这是一个谎言。
    【解决方案2】:

    另一种解决方案是简单地重新安装 R:

    brew reinstall r
    

    这会将 R 重新链接到正确的库,并且您不会有任何可能成为孤立或以后导致问题的符号链接。这不会影响您已经安装的任何 R 包。此外,如果您已经使用 brew 安装了最新版本的 R 并且瓶子仍在您的计算机上,那么您不必再次下载瓶子。

    【讨论】:

    • 虽然我喜欢 Kamil 提供的故障排除信息,但这看起来是正确的解决方案,我只是自己运行它。 imo 我们应该避免手动链接解决方案,因为该工具将为我们解决问题。
    【解决方案3】:

    在我的情况下,运行 uninstallreinstall 并没有解决问题。运行brew doctor 显示我有无衬里的小桶,包括gcc 运行brew link gcc 解决了这个问题。

    【讨论】:

      【解决方案4】:

      brew upgrade R 在大多数情况下会确保安装要求:

      ==> Upgrading 1 outdated package:
      r 3.5.3 -> 3.6.1
      ==> Upgrading r
      ==> Pouring r-3.6.1.mojave.bottle.tar.gz
      ?  /usr/local/Cellar/r/3.6.1: 2,121 files, 56.6MB
      Removing: /usr/local/Cellar/r/3.5.3... (2,118 files, 55.8MB)
      

      【讨论】:

        【解决方案5】:

        我遇到了类似的错误,首先是“libopenblas”,然后是使用 R 3.5.2_2 的 Mac OSX 10.14 上的“libgfortran”。

        通过这样做解决了它:

        brew upgrade R
        
        Updating Homebrew...
        ==> Auto-updated Homebrew!
        Updated 2 taps (homebrew/cask and homebrew/bundle).
        No changes to formulae.
        
        ==> Upgrading 1 outdated package:
        r 3.5.2_2 -> 3.6.1
        ==> Upgrading r 
        ==> Downloading https://homebrew.bintray.com/bottles/r-3.6.1.mojave.bottle.tar.gz
        ==> Downloading from https://akamai.bintray.com/1e/1ed9fe16ae694fa3b35a7d979853447eb7b8aec1e804019a1bf4aafa299a6696?__gd
        ######################################################################## 100.0%
        ==> Pouring r-3.6.1.mojave.bottle.tar.gz
        ?  /usr/local/Cellar/r/3.6.1: 2,121 files, 56.6MB
        Removing: /usr/local/Cellar/r/3.4.1_2... (2,113 files, 55.2MB)
        Removing: /usr/local/Cellar/r/3.5.1... (2,116 files, 55.6MB)
        Removing: /usr/local/Cellar/r/3.5.2_2... (2,119 files, 56.0MB)
        

        R 之后完美运行:

        R version 3.6.1 (2019-07-05) -- "Action of the Toes"
        Copyright (C) 2019 The R Foundation for Statistical Computing
        Platform: x86_64-apple-darwin18.6.0 (64-bit)
        

        【讨论】:

          猜你喜欢
          • 2021-07-14
          • 2020-04-19
          • 2020-03-19
          • 1970-01-01
          • 2015-05-15
          • 2013-10-13
          • 2021-11-20
          • 2012-05-08
          相关资源
          最近更新 更多