Anacondas Numpyλ₯Ό μ¬μ©νλ μ¬κΈ°μ ν¨ν€μ§ λ κ²μ μ¬μ©νλ Numpyλ μΌλΆ κΈ°λ₯κ³Ό μΆ©λν©λλ€. μ€λ₯ λ©μμ§λ λ€μκ³Ό κ°μ΅λλ€.
Intel MKL FATAL ERROR: Cannot load mkl_intel_thread.dll.
κ³Ό
The procedure entry point mkl_aa_fw_get_max_memory could not be located in the dynamic link library C:\Program Files\Python 3.5\lib\site-packages\numpy\core\mkl_intel_thread.dll.
Numpy 1.9.2 (Python 3.3.5μμ ν μ€νΈ λ¨)λ μ μμ μΌλ‘ μλν©λλ€ (νμ§λ§ ν΄λΉ λλ ν 리μλ .dllμ΄ μμ).
λΉλΆκ° Numpy 1.9λ‘ λ€μ΄ κ·Έλ μ΄λνμ΅λλ€. MKLμ λν΄ ν μ€νΈνμ§ μλ κ²μ μκ³ μμ§λ§ ννΈκ° μμ΅λκΉ?
>>> platform.platform()
'Windows-10.0.10586'
>>> sys.version
'3.5.0 (v3.5.0:374f501f4567, Sep 13 2015, 02:27:37) [MSC v.1900 64 bit (AMD64)]'
>>> np.__version__
'1.10.2'
>>> np.show_config()
blas_opt_info:
define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
libraries = ['mkl_lapack95_lp64', 'mkl_blas95_lp64', 'mkl_rt']
library_dirs = ['C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/mkl/lib/intel64_win']
include_dirs = ['C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/mkl/include']
lapack_mkl_info:
define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
libraries = ['mkl_lapack95_lp64', 'mkl_blas95_lp64', 'mkl_rt', 'mkl_lapack95_lp64', 'mkl_blas95_lp64', 'mkl_rt']
library_dirs = ['C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/mkl/lib/intel64_win']
include_dirs = ['C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/mkl/include']
lapack_opt_info:
define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
libraries = ['mkl_lapack95_lp64', 'mkl_blas95_lp64', 'mkl_rt', 'mkl_lapack95_lp64', 'mkl_blas95_lp64', 'mkl_rt']
library_dirs = ['C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/mkl/lib/intel64_win']
include_dirs = ['C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/mkl/include']
blas_mkl_info:
define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
libraries = ['mkl_lapack95_lp64', 'mkl_blas95_lp64', 'mkl_rt']
library_dirs = ['C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/mkl/lib/intel64_win']
include_dirs = ['C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/mkl/include']
mkl_info:
define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
libraries = ['mkl_lapack95_lp64', 'mkl_blas95_lp64', 'mkl_rt']
library_dirs = ['C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/mkl/lib/intel64_win']
include_dirs = ['C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/mkl/include']
openblas_lapack_info:
NOT AVAILABLE
ν , μ¬κΈ°μ λ¬΄μ¨ μΌμ΄ μΌμ΄λκ³ μλμ§ λͺ¨λ₯΄κ² μ΅λλ€. μΈν μ λΉλμ λͺ κ°μ§ λ³κ²½ μ¬νμ μ μ©νμ§λ§ κ΄λ ¨ λ΄μ©μ΄ μλ€κ³ μκ°ν©λλ€. Python 3.5λ Windowsμμ μ΅μ VSλ‘ μ»΄νμΌλκΈ° λλ¬Έμ κ°λ₯ν λ²μΈμ λλ€. @cgohlke μκ°?
κ°μ₯ μ’μ λ°©λ²μ μ¬ν κΈ°λ₯Ό μ 곡νλ κ²μ΄λΌκ³ μκ°ν©λλ€ (μ΄κ²μ μμ±νλ "μΌλΆ κΈ°λ₯"μ 무μμ λκΉ?). κ·Έλ€μ MKL λΉλμ μ°λ¦¬λ κ·Έλ μ§ μμ΅λλ€).
"μΌλΆ κΈ°λ₯"μ λν΄ μ£μ‘ν©λλ€. :)-matplotlibλ₯Ό ν΅ν΄ κ°μ μ μΌλ‘ μΆ©λνμ΅λλ€.
μ΄κ²μ λκ°μ΄ μΆ©λν©λλ€.
A = np.arange(2*3).reshape(2,3).astype(np.float32)
B = np.arange(2*3*2731).reshape(2,3,2731).astype(np.int16)
np.dot(A, B)
λ΄ λ ΈνΈλΆ μμ μ΅μ
>>> np.show_config()
openblas_lapack_info:
NOT AVAILABLE
lapack_mkl_info:
include_dirs = ['C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/mkl/include']
libraries = ['mkl_lapack95_lp64', 'mkl_blas95_lp64', 'mkl_rt', 'mkl_lapack95_lp64', 'mkl_blas95_lp64', 'mkl_rt']
library_dirs = ['C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/mkl/lib/intel64_win']
define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
lapack_opt_info:
include_dirs = ['C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/mkl/include']
libraries = ['mkl_lapack95_lp64', 'mkl_blas95_lp64', 'mkl_rt', 'mkl_lapack95_lp64', 'mkl_blas95_lp64', 'mkl_rt']
library_dirs = ['C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/mkl/lib/intel64_win']
define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
mkl_info:
include_dirs = ['C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/mkl/include']
libraries = ['mkl_lapack95_lp64', 'mkl_blas95_lp64', 'mkl_rt']
library_dirs = ['C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/mkl/lib/intel64_win']
define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
blas_mkl_info:
include_dirs = ['C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/mkl/include']
libraries = ['mkl_lapack95_lp64', 'mkl_blas95_lp64', 'mkl_rt']
library_dirs = ['C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/mkl/lib/intel64_win']
define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
blas_opt_info:
include_dirs = ['C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/mkl/include']
libraries = ['mkl_lapack95_lp64', 'mkl_blas95_lp64', 'mkl_rt']
library_dirs = ['C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/mkl/lib/intel64_win']
define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
>>> import numpy as np
>>> A = np.arange(2*3).reshape(2,3).astype(np.float32)
>>> B = np.arange(2*3*2731).reshape(2,3,2731).astype(np.int16)
>>> np.dot(A, B)
array([[[ 13655., 13658., 13661., ..., 21839., 21842., 21845.],
[ 38234., 38237., 38240., ..., 46418., 46421., 46424.]],
[[ 38234., 38246., 38258., ..., 70970., 70982., 70994.],
[ 136550., 136562., 136574., ..., 169286., 169298., 169310.]]], dtype=float32)
λ λ€ λμκ² μμλλ‘ μλν©λλ€.
λλ μ€λ₯ μΆμΈ‘ Intel MKL FATAL ERROR: Cannot load mkl_intel_thread.dll
μλͺ»λ λλ¬Έμ μ€λͺ
λ μμ΄ λ²μ μ΄ mkl_intel_thread.dll
μμ λ°κ²¬ somwhereμ PATH
. numpy + MKLμμ μν ν κ²μ²λΌ PATH
λ₯Ό νμ₯νμ¬ MKL DLLμ μ°Ύλ κ²μ μμ€ν
μ λ€λ₯Έ MKL λ°νμμ΄ μ€μΉλμ΄μλ κ²½μ° μ·¨μ½ν©λλ€.
C : \ Windows * λλ ν 리μ libiomp5md.dll
λλ mkl_*.dll
νμΌμ΄ μμ΅λκΉ?
@cgohlke , numpy + MKLμμ numpy.core
μ PATH
μ μΆκ°νκΈ° μν΄ _init_numpy_mkl()
λ₯Ό λμ
νμ΅λλ€.
DLL κ²μ μμλ₯Ό λ³κ²½νκΈ° μν΄ https://gist.github.com/matham/f6a07f8fb5e403feb440 μ λ€μ μ κ·Ό λ°©μμ κ³ λ € νμ΅λκΉ?
λν보μμμ€:
https://pytools.codeplex.com/workitem/1627 (μΆμ²)
https://github.com/numpy/numpy/wiki/windows-dll-notes#python -dlls
http://stackoverflow.com/questions/23804438/find-library-in-ctypes
@cgohlke λ€μμ λ΄ Windows λλ ν°λ¦¬μμλ DLLμ λλ€.
['System32\\libiomp5md.dll',
'System32\\mkl_core.dll',
'System32\\mkl_def.dll',
'System32\\mkl_intel_thread.dll',
'SysWOW64\\libiomp5md.dll',
'SysWOW64\\mkl_core.dll',
'SysWOW64\\mkl_intel_thread.dll',
'SysWOW64\\mkl_p4.dll',
'SysWOW64\\mkl_p4m.dll',
'SysWOW64\\mkl_p4m3.dll',
'SysWOW64\\mkl_p4p.dll']
νμ΄μ¬μ νΈμΆνκΈ° μ μ SET PATH=;
λ΄ PATHλ₯Ό μ¬μ€μ νλ €κ³ νλ©΄ μ¬μ ν μΆ©λμ΄ λ°μνμ§λ§ Windows λλ ν 리μμ μμ DLLμ μμ ν μ κ±°νλ©΄ μΆ©λμ΄ μ€μ§λ©λλ€. κ²½λ‘ μ°μ μμ λ¬Έμ @carlklμ²λΌ 보μ
λλ€.
@cgohlke , numpy + MKLμ __init__.py
λ‘ ν
μ€νΈνκΈ° μν΄ λ€μ λ³κ²½μ μ μν©λλ€.
def _init_numpy_mkl():
# Numpy+MKL on Windows only
import os
import ctypes
if os.name != 'nt':
return
# disable Intel Fortran default console event handler
env = 'FOR_DISABLE_CONSOLE_CTRL_HANDLER'
if env not in os.environ:
os.environ[env] = '1'
# extend DLL search order with numpy.core
# See https://github.com/numpy/numpy/wiki/windows-dll-notes#python-dlls
# and https://pytools.codeplex.com/workitem/1627
try:
_AddDllDirectory = ctypes.windll.kernel32.AddDllDirectory
_AddDllDirectory.argtypes = [ctypes.c_wchar_p]
# Needed to initialize AddDllDirectory modifications
ctypes.windll.kernel32.SetDefaultDllDirectories(0x1000)
except AttributeError:
_AddDllDirectory = ctypes.windll.kernel32.SetDllDirectoryW
_AddDllDirectory.argtypes = [ctypes.c_wchar_p]
try:
_core = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'core')
_AddDllDirectory(_core)
except Exception:
pass
_init_numpy_mkl()
del _init_numpy_mkl
Windows λλ ν 리μμ μμ DLLμ μμ ν μ κ±°νλ©΄ μΆ©λμ΄ μ€μ§λ©λλ€.
μ’μ λΌμ΄λ©.
numpy + MKLμ
__init__.py
λ‘ ν μ€νΈνκΈ° μν΄ λ€μ λ³κ²½μ μ μν©λλ€.
μ΄κ²μ ꡬν μμ€ν μμ μ€μ λ‘ μλνμ§ μμΌλ©° λ μ€μν κ²μ μμ€ν μ DLL κ²μ μμ μ μμ‘΄νλ ν¨ν€μ§λ₯Ό κΉ¨λ¨λ¦½λλ€. Anaconda λλ WinPythonκ³Ό κ°μ λ°°ν¬νμ νμ© λ μ μμ΅λλ€.
numpy wikiμμ λΆλΆμ μΌλ‘ @carlkl μΌλ‘ μΈμ λ AddDllDirectory
λ©μλλ₯Ό μ²μ λ°κ²¬ ν κ²μ΄ μ¬λ―Έ μμμ§λ§ , μ¬κΈ°μμ @carlkl μ΄ μμ λ‘ μ¬μ©μ μ μ AddDllDirectory
κ²μ ν λ ν΄λΉ μμ μ½λμ λ¬Έμ μ λν μ€λͺ
μ
λλ€. ν μν΄ ...
μ΄μ¨λ , λλ μ΄κ²μ μ¬μ©νλ κ²μ κ³ λ €νλ λ€λ₯Έ μ¬λλ€μ μν΄ μΌλΆ dllμλ‘λ ν λ ctypes.windll.kernel32.SetDefaultDllDirectories(0x1000)
(λ° 0μ΄ μλ λ€λ₯Έ νλκ·Έ)μ΄ ImportError: DLL load failed: The parameter is incorrect
μμΈλ₯Ό λ°μ μν¨λ€λ μ μ μ£Όλͺ©νκ³ μΆμμ΅λλ€. λμκ² κ·Έκ²μ mingw-w64λ‘ λ°λΉμμμ ν¬λ‘μ€ μ»΄νμΌ λ ffmpeg dllμ μ°κ²°λ mingw-w64 (mingwpy) λΉλ νμ₯μμλ§ λ°μνμ΅λλ€. νμ§λ§ κ·Έκ² μ±
μμ΄ μλμ§λ λͺ¨λ₯΄κ² μ΅λλ€.
κ·Έλ¬λ, νμ΄μ¬μ νΈμΆνκΈ° λλ¬Έμ LoadLibraryEx
λ§μ LOAD_WITH_ALTERED_SEARCH_PATH
νμ§μ LOAD_LIBRARY_SEARCH_USER_DIRS
νμ§ μλ ν, SetDefaultDllDirectories
λ λΆλ € LOAD_LIBRARY_SEARCH_USER_DIRS
, LoadLibraryEx
λ AddDllDirectory
μΆκ° λ λλ ν 리λ₯Ό κ²μνμ§ μμ΅λλ€. λμκ² μ΄κ²μ μ¬μ©νκΈ°κ° μ½κ° κΉ¨μ§κΈ° μ¬μ΄ κ²μ²λΌ 보μ΄λ―λ‘ os.environ
κ²½λ‘μ dll λλ ν 리λ₯Ό μΆκ°νλ κ²μΌλ‘ λ€μ μ ν ν κ²μ΄λΌκ³ μκ°ν©λλ€. κ·Έλλμ΄ μ λ³΄λ‘ μν€λ₯Ό μ
λ°μ΄νΈν΄μΌνλμ§ κΆκΈν©λλ€.
μ΄μ¨λ μ΄κ²μ λ무 λ©μ§ μμ μ£Όμ κ° μλκΈ°λ₯Ό λ°λλλ€.
@matham ,μ΄ μ½λ μ€ λν«μ _zooba_μ μ 립λμ΄μΌν©λλ€-https://pytools.codeplex.com/workitem/1627 μ°Έμ‘°. ctypes.windll.kernel32.SetDefaultDllDirectories(0x1000)
νμ LoadLibraryEx
λ‘ LOAD_WITH_ALTERED_SEARCH_PATH
LoadLibraryEx
μ λμμ λ³κ²½νμ§ μμ΅λλ€. random \ mtrand.pydκ°λ‘λ λ μ§ν MKL_INTEL_THREAD.DLL
λ‘λμ μ¬μ© λ LoadLibraryA
(_without_ LOAD_WITH_ALTERED_SEARCH_PATH
)μ λμμ _ ν¬λ§μ μΌλ‘ _ λ³κ²½νκ³ MKL_RT.DLL
λ€μ MKL_INTEL_THREAD.DLL
νΈμΆ :
python -c "import numpy"
λμ depency walkerμμ λ‘κ·ΈμΈ
...
LoadLibraryExW("d:\devel\py\python-3.5.0.amd64\lib\site-packages\numpy\random\mtrand.cp35-win_amd64.pyd", 0x0000000000000000, LOAD_WITH_ALTERED_SEARCH_PATH) called from "d:\devel\py\python-3.5.0.amd64\PYTHON35.DLL" at address 0x00000000587E7747.
Loaded "d:\devel\py\python-3.5.0.amd64\lib\site-packages\numpy\random\MTRAND.CP35-WIN_AMD64.PYD" at address 0x000007FEF3310000. Successfully hooked module.
DllMain(0x000007FEF3310000, DLL_PROCESS_ATTACH, 0x0000000000000000) in "d:\devel\py\python-3.5.0.amd64\lib\site-packages\numpy\random\MTRAND.CP35-WIN_AMD64.PYD" called.
DllMain(0x000007FEF3310000, DLL_PROCESS_ATTACH, 0x0000000000000000) in "d:\devel\py\python-3.5.0.amd64\lib\site-packages\numpy\random\MTRAND.CP35-WIN_AMD64.PYD" returned 1 (0x1).
LoadLibraryExW("d:\devel\py\python-3.5.0.amd64\lib\site-packages\numpy\random\mtrand.cp35-win_amd64.pyd", 0x0000000000000000, LOAD_WITH_ALTERED_SEARCH_PATH) returned 0x000007FEF3310000.
LoadLibraryA("d:\devel\py\python-3.5.0.amd64\lib\site-packages\numpy\core\mkl_intel_thread.dll") called from "d:\devel\py\python-3.5.0.amd64\lib\site-packages\numpy\core\MKL_RT.DLL" at address 0x000007FEE17C4772.
Loaded "d:\devel\py\python-3.5.0.amd64\lib\site-packages\numpy\core\MKL_INTEL_THREAD.DLL" at address 0x000007FEE0520000. Successfully hooked module.
Loaded "d:\devel\py\python-3.5.0.amd64\lib\site-packages\numpy\core\MKL_CORE.DLL" at address 0x000007FEDEEC0000. Successfully hooked module.
Loaded "d:\devel\py\python-3.5.0.amd64\lib\site-packages\numpy\core\LIBIOMP5MD.DLL" at address 0x000007FEE43E0000. Successfully hooked module.
...
@carlkl μ¬μ€μ΄μ§λ§ μν€λ₯Ό μΈκΈνμ΅λλ€ : (thanks to Steve Dower for the fragment, Carl Kleffner for finding it)
, λ΄κ° λΉμ μ΄λΌκ³ μκ°νμ΅λλ€ :)
λ΄κ° μΈκΈ ν μ·¨μ½μ±μ μΌλ°μ μΌλ‘ ν΄λΉ νλκ·Έλ₯Ό μ€μ νλ SetDefaultDllDirectories
νΈμΆκ³Ό λΌμ΄λΈλ¬λ¦¬κ° μ€μ λ‘λ‘λ λ λ μ€νλλ λ€λ₯Έ μ½λκ°μμ μ μλ€λ κ²μ
λλ€. μλ₯Ό λ€μ΄ μμ μ΄ SetDefaultDllDirectories
νΈμΆνλ κ²μ κ°μ Έ μ€λ κ²½μ° μλ§λ κ° (μ : 0)μ μ¬μ©νμ¬ κ°μ Έμ¬ λ λμ€μ dllμ μ°Ύμ§ λͺ»ν μ μμ΅λλ€. μ¦μ κ°μ Έ μ€λ©΄ μ¬κΈ°μμ λ¬Έμ κ°λμ§ μμ κ² κ°μ§λ§.
@cgohlke , numpy.core
λ΄μμ _init_numpy_mkl()
numpy.core
λν λͺ
μ μ κ²½λ‘ μ΄λ¦κ³Ό ν¨κ» MKL_RT.DLL
, MKL_INTEL_THREAD.DLL
λ° MKL_CORE.DLL
μ (λ₯Ό) 미리λ‘λνλ λ° λ¬Έμ κ° μμ΅λκΉ? λ€λ₯Έ νμν MKL DLLμ μ μ§μ μΌλ‘λ‘λκ° μλνλμ§ νμ€νμ§ μμ΅λλ€.
@cgohlke ,
λ€μ μ€ λν«μ MKL DLLμ΄ Windows μμ€ν μ΄λ Intel redist ν΄λκ° μλ numpy.coreμμλ‘λλλλ‘ν©λλ€ (?). DLLμλ‘λνλ μμκ° μ€μν©λλ€. μ μ΄λ Windows 7 python-3.4 λΉνΈμμ μλν©λλ€.
def _init_numpy_mkl():
# Numpy+MKL on Windows only
import os
import ctypes
if os.name != 'nt':
return
# disable Intel Fortran default console event handler
env = 'FOR_DISABLE_CONSOLE_CTRL_HANDLER'
if env not in os.environ:
os.environ[env] = '1'
# preload MKL DLLs from numpy.core
try:
_core = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'core')
for _dll in ('mkl_rt', 'libiomp5md', 'mkl_core', 'mkl_intel_thread',
'libmmd', 'libifcoremd', 'libimalloc'):
ctypes.cdll.LoadLibrary(os.path.join(_core,_dll))
except Exception:
pass
_init_numpy_mkl()
del _init_numpy_mkl
λλ κ°μ λ¬Έμ κ° μμκ³ danielgeierμ μν΄ C:\Windows\System32
mkl_intel_thread.dll
λ₯Ό μ€μΉ ν κ²μΌλ‘ λ€μ μΆμ νμ΅λλ€.
μ΄μ λ²μ μλ 무μ보λ€λ mkl_aa_fw_get_max_memory
κ° μμμ΅λλ€.
μμ± μκ°μ Asio4all μ€λμ€ λλΌμ΄λ² μ€μΉμ μΌμΉνμ΅λλ€. λͺ κ°μ dllμ μ κ±°ν νμ λ€μ μλνμ΅λλ€ (system32μμ dllμ μ§μ μμ νλ κ²λ³΄λ€ λ«μ΅λλ€).
λλ λ‘€λ°±νκ³ μλμ½λ€ λ°°ν¬νμ μ
λ°μ΄νΈνλ©΄μ λμμ§λ§ μλνμ§ μμμ΅λλ€. λν Windowsμμ μλμ½λ€λ‘ mklμ λΉνμ±ν ν μ μμ΅λλ€.
@ sebastian-schmidt, Windows μμ€ν ν΄λμ μ€λλ MKL DLLμ΄ μ€μΉλμ΄ μμ΄λ numpy / core ν΄λμμ λͺ μ μ μΌλ‘ MKL DLLμλ‘λνλ κ²μ΄ μλνλ€λ©΄ μ¬μ©ν΄ λ³Ό μ μμ΅λλ€. μ μ°Έμ‘° : https://github.com/numpy/numpy/issues/6923#issuecomment -169073613
@carlkl , μ€ λν«μ μ΄λμ μΆκ°ν΄μΌν©λκΉ?
ν
μ€νΈλ‘ μ¬μ©ν νμΌ ( https://gist.github.com/sebastian-schmidt/9bb97354b481750209fd3dac1e748d31)μ μΆκ°νλ €κ³ νμ§λ§ μλνμ§ μμμ΅λλ€.
κ²°ν© λ κ²½λ‘λ νμΌμ νΈμΆνλ νμ λλ ν 리μ
λλ€.
Numpy λͺ¨λμ initμ μΆκ°ν΄μΌν©λκΉ?
_init_numpy_mkl()
ν¨μλ @cgohlke numpy + mkl λ°ν΄μ μΌλΆμ
λλ€. __init__.py
νμΌμμ μ°Ύμ μ μμ΅λλ€. 곡μ numpy μμ€μ μΌλΆκ° μλλλ€.
λ€μμ numpy-1.10.4+mkl-cp34-none-win32.whl
μμλ λ²μ μ
λλ€.
def _init_numpy_mkl():
# Numpy+MKL on Windows only
import os
if os.name != 'nt':
return
# disable Intel Fortran default console event handler
env = 'FOR_DISABLE_CONSOLE_CTRL_HANDLER'
if env not in os.environ:
os.environ[env] = '1'
# prepend the path of the Intel runtime DLLs to os.environ['PATH']
try:
path = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'core')
if path not in os.environ.get('PATH', ''):
os.environ['PATH'] = os.pathsep.join((path, os.environ.get('PATH', '')))
except Exception:
pass
_init_numpy_mkl()
del _init_numpy_mkl
μ΄ ν¨μλ numpy/core
ν΄λλ₯Ό PATH
νκ²½μ μΆκ°ν©λλ€. κ·Έλ¬λ Windows μμ€ν
ν΄λμμλ DLLμ PATHμμλ DLLλ³΄λ€ μ°μ ν©λλ€. DLL μ§μ₯μ μ€μ κ²μ νμν©λλ€.
μ΄ ν¨μμ λ체 λ²μ https://github.com/numpy/numpy/issues/6923#issuecomment -169073613μ PATH
νκ²½μ λ³κ²½νμ§ μκ³ μ¬λ°λ₯Έ μμλ‘ numpy/core
μμ MKL DLLμλ‘λν©λλ€. λͺ¨λ DLL μ΄λ¦μ μ κ·ν λ κ²½λ‘ μ΄λ¦μ κ°μ§ λͺ
μ μ νμΌ μ΄λ¦μΌλ‘ μ 곡λλ―λ‘ Windows μμ€ν
ν΄λμ DLL μλ μ λ¬Έμ λ μμνμ§ μμ§λ§ ν
μ€νΈνμ§λ μμμ΅λλ€.
κ·Έλ¬λμ΄ μ½λ μ€ λν«μμ κ³ μ λ numpyλ μ κ²½ μ°μ§ μμμ΅λλ€.
Anaconda λ°°ν¬νμ _init_numpy_mkl()
μ (λ₯Ό) κ·νμ λ²μ μΌλ‘ λ³κ²½ ν λ€μ μλνμ΅λλ€ ( windows/system32
μμ νΈνλμ§ μλ dll μ¬μ©).
λ£κΈ° μ’μ!
_init_numpy_mklμ μ½λλ () @cgohlkeμ NumPyμ λΆν¬ λ° κ·Έμ responibility μλ λΆλΆμ΄λ€.
@cgohlke : https://github.com/numpy/numpy/issues/6923#issuecomment -169073613μ λν μκ²¬μ΄ μμ΅λκΉ?
@ sebastian-schmidt, AddDllDirectory (λλ λμ²΄λ‘ SetDllDirectoryW)λ₯Ό μ¬μ©νμ¬ λ²μ μ ν μ€νΈ ν μ μμ΅λκΉ? μ μ°Έμ‘° : https://github.com/numpy/numpy/issues/6923#issuecomment -168490201
@carlkl , AddDllDirectory / SetDllDirectoryW λ²μ λ μλν©λλ€.
ν
μ€νΈλ νμ danielgeierμ np.dot()
μμ μμ΅λλ€.
μ°Έκ³ λ‘ mkl λΌμ΄λΈλ¬λ¦¬λ₯Ό μ€μΉνλ μννΈμ¨μ΄λ Asio4all λλΌμ΄λ²κ° μλλΌ Amplitubeμμ΅λλ€.
λλ Amplitubeλ‘ λ¬Έμ λ₯Ό μΆμ νμ΅λλ€.
λ΄κ° μλνμ λ : import matplotlib.pyplot as plt
λ init λ²μ λͺ¨λμμ μ€λ₯κ° λ°μνμ΅λλ€.
---> 60 import matplotlib._png as _png
61 ####################
62
ImportError: DLL load failed: Das angegebene Modul wurde nicht gefunden.
κ·Έλμ Anaconda μλ λ²μ μΌλ‘ λ€μ μ ννκ³ Amplitubeλ₯Ό μ κ±°νμ΅λλ€.
@ sebastian-schmidt, μ μ΄λ λλ₯Ό μν΄ μλν©λλ€. numpy, scipy, matplotlib._png κ°μ Έ μ€κΈ°λ λ΄ μμμμ λ¬Έμ μμ΄ μλν©λλ€.
κ·Έλ¬λ Windows μμ€ν ν΄λμμ MKL DLLμ μ κ±°νλ κ²μ΄ μ΄λ¬ν μ’ λ₯μ λ¬Έμ μ λν μ΅μμ μ루μ μΌλ‘ 보μ λλ€.
μ΄ λ¬Έμ λ₯Ό μ’ κ²° ν μκ°μ λκΉ?
μλ νμΈμ. λκ΅°κ°κ° μ¬μ νμ΄ λ¬Έμ λ₯Ό κ°μ§κ³ μλ κ²½μ°λ₯Ό λλΉνμ¬. λλ numpy 1.12 + mklμ κ°μ§κ³ μμΌλ©° λμΌν λ¬Έμ κ° μμ΅λλ€. Amplitube 3μ μ κ±°νκ³ μ΄μ λͺ¨λ κ²μ΄ μλν©λλ€!
μλ νμΈμ μ¬λ¬λΆ,
λ κ·Έλ₯μμ μ΅μ NumPyμ + MKL 1.13 ν¨ν€μ§λ₯Ό μ€μΉ μ¬κΈ° @cgohlkeμ μν΄.
Windows 7μμ Anaconda w / Python 3.6.1 64 λΉνΈλ₯Ό μ€ννκ³ μμ΅λλ€.
κ·Έ νμ΄ DLL λ¬Έμ λ λ°μνκ³ μ΄μ μ λμΌν μ¬μ΄νΈμ v1.12μμ μ λλ‘ μλνμ΅λλ€.
μΆκ°νλ €λ©΄ μ€μ λ‘ λͺ¨λ μ½λκ° Jupyter λ ΈνΈλΆμμ μλν©λλ€ .... μ΄κ²μ μ½μμμλ§ λ°μν©λλ€.
@carlkl Anaconda ν΄λμμ _init_numpy_mkl
νμ§λ§μ΄ λ¬Έμμ΄μ΄ ν¬ν¨ λ νμΌμ μ°Ύμ μ μμ΅λλ€. numpy/core
λ₯Ό λ΄ PATH
νκ²½ λ³μμ μλμΌλ‘ μΆκ°ν΄λ μλνμ§ μμμ΅λλ€.
λ€λ₯Έ μ μμ΄ μμ΅λκΉ?
κ°μ¬.
λ΄κ° skimageλ₯Ό κ°μ Έμ¬ λ "mkl_intel_thread.dllμλ‘λ ν μ μμ΅λλ€"λΌλ λ¬Έμ κ° λ°μνμ΅λλ€.
windows / system32μμ mkl_intel_thread.dllμ μ°Ύμ μ μμΌλ―λ‘ @cgohlkeκ° μΈκΈ νλλ‘ ν΄λΉ ν΄λμμ libiomp5md.dllμ μμ νμ΅λλ€. μλν©λλ€! μ λ§ κ°μ¬ν©λλ€! λ¬Έμ λ λͺ μ£Ό λμ λλ₯Ό κ΄΄λ‘ νμ΅λλ€. μ΄μ¨λ λ€λ₯Έ μ¬λλ€ μ΄μ΄ λ¬Έμ λ₯Ό λ§λ¬ μΌλ©΄ λμμλ°μ μ μκΈ°λ₯Ό λ°λλλ€. libiomp5md.dllμ μ°ΎμΌμμμ€. λμμ΄ λ μ μμ΅λλ€.
https://github.com/numpy/numpy/issues/6923#issuecomment -169073613μ΄ Windows / system32μμ MKL DLLμ μ κ±° ν νμμμ΄μ΄ κ²½μ° μλνλμ§ κΆκΈν©λλ€. μ΄ μ€ λν«μ μΆκ° λΌμ΄λΈλ¬λ¦¬λ₯Ό PATH νκ²½ λ³μμ μ λ¬νκ±°λ λ€λ₯Έ νΈλ¦μ μ¬μ©ν νμμμ΄ numpy / core ν΄λμ 7 κ° (μ λΆλ μλ) MKL DLLμλ‘λ ν μ μμμ 보μ¬μ€λλ€. μ΄ 7 κ°μ DLLμ μ¬λ°λ₯Έ μμλ‘λ‘λνλ κ²μ΄ μ€μν©λλ€. λ€λ₯Έ λͺ¨λ νμ MKL DLLμ windows / system32 ν΄λ λμ numpy / coreμμ μλμΌλ‘λ‘λλ©λλ€.
μ΄κ²μ΄ μκ°ν μμλ λͺ¨λ μλ리μ€μμ μλνλμ§λ μμ§ νμ€νμ§ μμ΅λλ€. μλ₯Ό λ€μ΄, κ³ μ λ νμ΄μ¬ μ ν리μΌμ΄μ . λν Windows OS λ²μ μ DLLμλ‘λ λμμ΄ λ€λ₯Ό μ μμ΅λλ€.
μ΄ λ³μ’ μ μΆκ°λ‘ μ‘°μ¬νλ κ²μ΄ μ 리ν κ² κ°μ΅λλ€.
μ°λ¦¬λ SetDefaultDllDirectories
μλ€λ‘ κ°κ³ # 10229κ° μΆκ° ν λ€μ # 11493μ΄ μ κ±°νμ΅λλ€. λλ μ°λ¦¬κ° μ΄κ²μΌλ‘ κ° μμλ ν λ©λ¦¬ κ°λ€κ³ μκ°ν©λλ€. κ°μ₯ μ’μ λ°©λ²μ PATHμμ mklμ λ€λ₯Έ 볡μ¬λ³Έμ μ κ±°νλ κ²μ
λλ€.
λμνμ§ μμΌλ©΄ λ€μμ¬μμμ€.
κ°μ₯ μ μ©ν λκΈ
@cgohlke λ€μμ λ΄ Windows λλ ν°λ¦¬μμλ DLLμ λλ€.
νμ΄μ¬μ νΈμΆνκΈ° μ μ
SET PATH=;
λ΄ PATHλ₯Ό μ¬μ€μ νλ €κ³ νλ©΄ μ¬μ ν μΆ©λμ΄ λ°μνμ§λ§ Windows λλ ν 리μμ μμ DLLμ μμ ν μ κ±°νλ©΄ μΆ©λμ΄ μ€μ§λ©λλ€. κ²½λ‘ μ°μ μμ λ¬Έμ @carlklμ²λΌ 보μ λλ€.