未加载库:libmkl_intel_lp64.dylib,在OS X上使用Anaconda

时间:2016-02-14 14:42:42

标签: python numpy anaconda

我无法在OS X(10.11.3)上使用支持MKL的NumPy版本。模块似乎安装正常,但当我尝试导入它时,我收到错误Library not loaded: @loader_path/../../../../libmkl_intel_lp64.dylib。实际上,如果我搜索此文件(mdfind -name libmkl_intel_lp64.dylib),则不会返回任何内容。这是包或我的安装有问题吗?同样的过程在我的Windows机器上完美运行。我可以毫无困难地安装nomkl版本并导入它,但如果可以使用MKL我想使用它。

编辑:从mkl包(http://anaconda.org/anaconda/mkl/files)手动安装dylib似乎工作 - 也许这是一个错误?

安装NumPy

snorfmac-2:~ snorf$ source activate snowflake
discarding /Users/snorf/miniconda3/bin from PATH
prepending /Users/snorf/miniconda3/envs/snowflake/bin to PATH
(snowflake)snorfmac-2:~ snorf$ conda install numpy
Using Anaconda Cloud api site https://api.anaconda.org
Fetching package metadata: ......
Solving package specifications: .............
Package plan for installation in environment /Users/snorf/miniconda3/envs/snowflake:

The following NEW packages will be INSTALLED:

    mkl:   11.3.1-0     
    numpy: 1.10.4-py34_0

Proceed ([y]/n)? 

Linking packages ...
[      COMPLETE      ]|###################################################| 100%

试图导入模块

(snowflake)snorfmac-2:~ snorf$ python
Python 3.4.4 |Continuum Analytics, Inc.| (default, Jan  9 2016, 17:30:09) 
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/snorf/miniconda3/envs/snowflake/lib/python3.4/site-packages/numpy/__init__.py", line 184, in <module>
    from . import add_newdocs
  File "/Users/snorf/miniconda3/envs/snowflake/lib/python3.4/site-packages/numpy/add_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
  File "/Users/snorf/miniconda3/envs/snowflake/lib/python3.4/site-packages/numpy/lib/__init__.py", line 8, in <module>
    from .type_check import *
  File "/Users/snorf/miniconda3/envs/snowflake/lib/python3.4/site-packages/numpy/lib/type_check.py", line 11, in <module>
    import numpy.core.numeric as _nx
  File "/Users/snorf/miniconda3/envs/snowflake/lib/python3.4/site-packages/numpy/core/__init__.py", line 14, in <module>
    from . import multiarray
ImportError: dlopen(/Users/snorf/miniconda3/envs/snowflake/lib/python3.4/site-packages/numpy/core/multiarray.so, 10): Library not loaded: @loader_path/../../../../libmkl_intel_lp64.dylib
  Referenced from: /Users/snorf/miniconda3/envs/snowflake/lib/python3.4/site-packages/numpy/core/multiarray.so
  Reason: image not found

1 个答案:

答案 0 :(得分:5)

由于某些原因,安装了mkl软件包,但未完全提取存档。后续安装使用了这种不完整的提取。运行conda install --debug mkl

时会报告此情况
DEBUG:conda.install:pkgs_dir='/Users/snorf/miniconda3/pkgs', prefix='/Users/snorf/miniconda3/envs/python34', dist='mkl-11.3.1-0', linktype=1
ERROR:conda.install:failed to link (src='/Users/snorf/miniconda3/pkgs/mkl-11.3.1-0/lib/libmkl_avx512.dylib', dst='/Users/snorf/miniconda3/envs/python34/lib/libmkl_avx512.dylib', type=1, error=FileNotFoundError(2, 'No such file or directory'))
ERROR:conda.install:failed to link (src='/Users/snorf/miniconda3/pkgs/mkl-11.3.1-0/lib/libmkl_core.dylib', dst='/Users/snorf/miniconda3/envs/python34/lib/libmkl_core.dylib', type=1, error=FileNotFoundError(2, 'No such file or directory'))
ERROR:conda.install:failed to link (src='/Users/snorf/miniconda3/pkgs/mkl-11.3.1-0/lib/libmkl_intel.dylib', dst='/Users/snorf/miniconda3/envs/python34/lib/libmkl_intel.dylib', type=1, error=FileNotFoundError(2, 'No such file or directory'))
ERROR:conda.install:failed to link (src='/Users/snorf/miniconda3/pkgs/mkl-11.3.1-0/lib/libmkl_intel_ilp64.dylib', dst='/Users/snorf/miniconda3/envs/python34/lib/libmkl_intel_ilp64.dylib', type=1, error=FileNotFoundError(2, 'No such file or directory'))
ERROR:conda.install:failed to link (src='/Users/snorf/miniconda3/pkgs/mkl-11.3.1-0/lib/libmkl_intel_lp64.dylib', dst='/Users/snorf/miniconda3/envs/python34/lib/libmkl_intel_lp64.dylib', type=1, error=FileNotFoundError(2, 'No such file or directory'))
ERROR:conda.install:failed to link (src='/Users/snorf/miniconda3/pkgs/mkl-11.3.1-0/lib/libmkl_intel_thread.dylib', dst='/Users/snorf/miniconda3/envs/python34/lib/libmkl_intel_thread.dylib', type=1, error=FileNotFoundError(2, 'No such file or directory'))
ERROR:conda.install:failed to link (src='/Users/snorf/miniconda3/pkgs/mkl-11.3.1-0/lib/libmkl_mc.dylib', dst='/Users/snorf/miniconda3/envs/python34/lib/libmkl_mc.dylib', type=1, error=FileNotFoundError(2, 'No such file or directory'))
ERROR:conda.install:failed to link (src='/Users/snorf/miniconda3/pkgs/mkl-11.3.1-0/lib/libmkl_mc3.dylib', dst='/Users/snorf/miniconda3/envs/python34/lib/libmkl_mc3.dylib', type=1, error=FileNotFoundError(2, 'No such file or directory'))
ERROR:conda.install:failed to link (src='/Users/snorf/miniconda3/pkgs/mkl-11.3.1-0/lib/libmkl_rt.dylib', dst='/Users/snorf/miniconda3/envs/python34/lib/libmkl_rt.dylib', type=1, error=FileNotFoundError(2, 'No such file or directory'))
ERROR:conda.install:failed to link (src='/Users/snorf/miniconda3/pkgs/mkl-11.3.1-0/lib/libmkl_sequential.dylib', dst='/Users/snorf/miniconda3/envs/python34/lib/libmkl_sequential.dylib', type=1, error=FileNotFoundError(2, 'No such file or directory'))
ERROR:conda.install:failed to link (src='/Users/snorf/miniconda3/pkgs/mkl-11.3.1-0/lib/libmkl_vml_avx.dylib', dst='/Users/snorf/miniconda3/envs/python34/lib/libmkl_vml_avx.dylib', type=1, error=FileNotFoundError(2, 'No such file or directory'))
ERROR:conda.install:failed to link (src='/Users/snorf/miniconda3/pkgs/mkl-11.3.1-0/lib/libmkl_vml_avx2.dylib', dst='/Users/snorf/miniconda3/envs/python34/lib/libmkl_vml_avx2.dylib', type=1, error=FileNotFoundError(2, 'No such file or directory'))
ERROR:conda.install:failed to link (src='/Users/snorf/miniconda3/pkgs/mkl-11.3.1-0/lib/libmkl_vml_avx512.dylib', dst='/Users/snorf/miniconda3/envs/python34/lib/libmkl_vml_avx512.dylib', type=1, error=FileNotFoundError(2, 'No such file or directory'))
ERROR:conda.install:failed to link (src='/Users/snorf/miniconda3/pkgs/mkl-11.3.1-0/lib/libmkl_vml_mc.dylib', dst='/Users/snorf/miniconda3/envs/python34/lib/libmkl_vml_mc.dylib', type=1, error=FileNotFoundError(2, 'No such file or directory'))
ERROR:conda.install:failed to link (src='/Users/snorf/miniconda3/pkgs/mkl-11.3.1-0/lib/libmkl_vml_mc2.dylib', dst='/Users/snorf/miniconda3/envs/python34/lib/libmkl_vml_mc2.dylib', type=1, error=FileNotFoundError(2, 'No such file or directory'))
ERROR:conda.install:failed to link (src='/Users/snorf/miniconda3/pkgs/mkl-11.3.1-0/lib/libmkl_vml_mc3.dylib', dst='/Users/snorf/miniconda3/envs/python34/lib/libmkl_vml_mc3.dylib', type=1, error=FileNotFoundError(2, 'No such file or directory'))

删除违规目录并重新安装mkl软件包。