"DLL load failed" error when importing Miniconda python sklearn library from Statistica python node

"DLL load failed" error when importing Miniconda python sklearn library from Statistica python node

book

Article ID: KB0076938

calendar_today

Updated On: 10-20-2019

Products Versions
Spotfire Statistica 13.5 and above

Description

Problem Recap:
1. User has Miniconda Python (e.g. Miniconda Python 3.7) integrated with Statistica.

2. User has installed mkl sklearn library for Miniconda python:
 
>cd  C:\Miniconda3\Scripts
>conda install numpy numpy-base scipy scikit-learn mkl --force-reinstall
Collecting package metadata (current_repodata.json): done
Solving environment: done
## Package Plan ##
environment location:  C:\Miniconda3
added / updated specs:
- mkl
- numpy
- numpy-base
- scikit-learn
- scipy
Proceed ([y]/n)? y
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
>conda list
# packages in environment at  C:\Miniconda3:
# Name Version Build Channel
comtypes 1.1.7 py37_0
conda 4.7.12 py37_0
conda-package-handling 1.6.0 py37h62dcd97_0
mkl 2019.4 245
mkl-service 2.3.0 py37hb782905_0
mkl_fft 1.0.14 py37h14836fe_0
mkl_random 1.1.0 py37h675688f_0
numpy 1.16.5 py37h19fb1c0_0
numpy-base 1.16.5 py37hc3f5095_0
python 3.7.3 h8c8aaf0_1
scikit-learn 0.21.3 py37h6288b17_0
scipy 1.3.1 py37h29ff71c_0
 
3. When importing sklearn libraries from Statistica python node, for example, "from sklearn import decomposition", user receives below "DLL load failed" error:
 
-----------------------------------------------------------------------------
Traceback (most recent call last):
User code, line 4, in <module>
from sklearn import decomposition
File " C:\Miniconda3\lib\site-packages\sklearn\__init__.py", line 76, in <module>
from .base import clone
File " C:\Miniconda3\lib\site-packages\sklearn\base.py", line 16, in <module>
from .utils import _IS_32BIT
File " C:\Miniconda3\lib\site-packages\sklearn\utils\__init__.py", line 20, in <module>
from .validation import (as_float_array,
File " C:\Miniconda3\lib\site-packages\sklearn\utils\validation.py", line 21, in <module>
from .fixes import _object_dtype_isnan
File " C:\Miniconda3\lib\site-packages\sklearn\utils\fixes.py", line 18, in <module>
from scipy.sparse.linalg import lsqr as sparse_lsqr # noqa
File " C:\Miniconda3\lib\site-packages\scipy\sparse\linalg\__init__.py", line 116, in <module>
from .eigen import *
File " C:\Miniconda3\lib\site-packages\scipy\sparse\linalg\eigen\__init__.py", line 11, in <module>
from .arpack import *
File " C:\Miniconda3\lib\site-packages\scipy\sparse\linalg\eigen\arpack\__init__.py", line 22, in <module>
from .arpack import *
File " C:\Miniconda3\lib\site-packages\scipy\sparse\linalg\eigen\arpack\arpack.py", line 45, in <module>
from . import _arpack
ImportError: DLL load failed: The specified procedure could not be found.
----------------------------------------------------------------------------- 

Issue/Introduction

How to troubleshoot the "ImportError: DLL load failed" error received when importing Miniconda python sklearn library from Statistica python node?

Environment

Windows

Resolution

1. To troubleshoot above error, user can use Windows "Process Monitor" to track which DLLs are missing when loading the sklearn python library.
Below two entries are found from python processes in Process Monitor when above error occurred. "libifcoremd.dll" and "libmmd.dll" are missing in specific locations. 

C:\Miniconda3\Lib\site-packages\scipy\sparse\linalg\eigen\arpack\libifcoremd.dll    NAME NOT FOUND
C:\Miniconda3\Lib\site-packages\scipy\sparse\linalg\isolve\libmmd.dll            NAME NOT FOUND

2. Searching through Miniconda python installation directory, the "libifcoremd.dll" and "libmmd.dll" DLL files are however found under path "C:\Miniconda3\Library\bin":

 
3. Copy the two DLLs ("libifcoremd.dll" and "libmmd.dll") to the respective paths shown in Process monitor, that is,
copy "libifcoremd.dll" from "C:\Miniconda3\Library\bin" folder and past it to the "C:\Miniconda3\Lib\site-packages\scipy\sparse\linalg\eigen\arpack" folder:
copy "libmmd.dll" file from "C:\Miniconda3\Library\bin" folder and past it to the "C:\Miniconda3\Lib\site-packages\scipy\sparse\linalg\isolve" folder:

 
4. Then re-run the Statistica python node with "from sklearn import decomposition". The "DLL failed loading" error vanished. The library is loaded successfully.