Error #15: Initializing libiomp5.dylib, but found libiomp5.dylib already initialized

后端 未结 9 1167
感动是毒
感动是毒 2020-12-01 05:34

Getting the error message when using matplotlib:

Error #15: Initializing libiomp5.dylib, but found libiomp5.dylib already initialized OMP: Hin

相关标签:
9条回答
  • 2020-12-01 05:55

    I had the same issue on macOS and found the following reasons:

    Problem:

    I had a conda environment where Numpy, SciPy and TensorFlow were installed.

    Conda is using Intel(R) MKL Optimizations, see docs:

    Anaconda has packaged MKL-powered binary versions of some of the most popular numerical/scientific Python libraries into MKL Optimizations for improved performance.

    The Intel MKL functions (e.g. FFT, LAPACK, BLAS) are threaded with the OpenMP technology.

    But on macOS you do not need MKL, because the Accelerate Framework comes with its own optimization algorithms and already uses OpenMP. That is the reason for the error message: OMP Error #15: ...

    Workaround:

    You should install all packages without MKL support:

    conda install nomkl

    and then use

    conda install numpy scipy pandas tensorflow

    followed by

    conda remove mkl mkl-service

    For more information see conda MKL Optimizations.

    0 讨论(0)
  • 2020-12-01 05:56

    Try to change the backend of matplotlib.

    For example, Tkagg backend causes this problem in my case. I changed it to Qt5Agg

    matplotlib.use('Qt5Agg') 
    

    and it helps.

    0 讨论(0)
  • 2020-12-01 06:02

    This is a better solution, if applicable. Else, anyway gcamargo’s solution is likely to work. However, it comes with a warning "that it may cause crashes or silently produce incorrect results"

    I had the same error on my Mac with a python program using numpy, keras, and matplotlib. I solved it with

    conda install nomkl

    Answer found at: https://github.com/dmlc/xgboost/issues/1715

    0 讨论(0)
提交回复
热议问题