簡體   English   中英

dyld:庫未加載:/usr/local/opt/openblas/lib/libopenblasp-r0.2.20.dylib

[英]dyld: Library not loaded: /usr/local/opt/openblas/lib/libopenblasp-r0.2.20.dylib

當我運行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 上使用自制軟件安裝 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

看看openblas安裝的版本是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:

brew reinstall r

這將根據正確的庫重新鏈接 R,並且您不會有任何可能成為孤立的或稍后導致問題的符號鏈接。 這不會影響您已經安裝的任何 R 包。 此外,如果您已經使用 brew 安裝了最新版本的 R 並且瓶子仍在您的計算機上,那么您將不必再次下載瓶子。

在我的情況下,運行uninstallreinstall並沒有解決問題。 運行brew doctor發現我有單衣小桶,包括gcc運行brew link gcc固定的問題。

在大多數情況下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)

我有一個類似的錯誤,首先是“libopenblas”,然后是 Mac OSX 10.14 上使用 R 3.5.2_2 的“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)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM