'ImportError: DLL load failed when importing sklearn in Jupyter with Anaconda
I updated Anaconda, and since then I can't import sklearn in my Jupyter Notebook. Here is my traceback:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-2-d20256e4506d> in <module>
4
5 # Scikit-Learn ≥0.20 is required
----> 6 import sklearn
7 # assert sklearn.__version__ >= "0.20"
8
~\Anaconda3\lib\site-packages\sklearn\__init__.py in <module>
80 from . import _distributor_init # noqa: F401
81 from . import __check_build # noqa: F401
---> 82 from .base import clone
83 from .utils._show_versions import show_versions
84
~\Anaconda3\lib\site-packages\sklearn\base.py in <module>
18
19 from . import __version__
---> 20 from .utils import _IS_32BIT
21
22 _DEFAULT_TAGS = {
~\Anaconda3\lib\site-packages\sklearn\utils\__init__.py in <module>
25 from ..exceptions import DataConversionWarning
26 from .deprecation import deprecated
---> 27 from .fixes import np_version
28 from .validation import (as_float_array,
29 assert_all_finite,
~\Anaconda3\lib\site-packages\sklearn\utils\fixes.py in <module>
16 import scipy.sparse as sp
17 import scipy
---> 18 import scipy.stats
19 from scipy.sparse.linalg import lsqr as sparse_lsqr # noqa
20
~\Anaconda3\lib\site-packages\scipy\stats\__init__.py in <module>
382 from __future__ import division, print_function, absolute_import
383
--> 384 from .stats import *
385 from .distributions import *
386 from .morestats import *
~\Anaconda3\lib\site-packages\scipy\stats\stats.py in <module>
183 import scipy.special as special
184 from scipy import linalg
--> 185 from . import distributions
186 from . import mstats_basic
187 from ._stats_mstats_common import (_find_repeats, linregress, theilslopes,
~\Anaconda3\lib\site-packages\scipy\stats\distributions.py in <module>
8 from __future__ import division, print_function, absolute_import
9
---> 10 from ._distn_infrastructure import (entropy, rv_discrete, rv_continuous,
11 rv_frozen)
12
~\Anaconda3\lib\site-packages\scipy\stats\_distn_infrastructure.py in <module>
23
24 # for root finding for discrete distribution ppf, and max likelihood estimation
---> 25 from scipy import optimize
26
27 # for functions of continuous distributions (e.g. moments, entropy, cdf)
~\Anaconda3\lib\site-packages\scipy\optimize\__init__.py in <module>
388
389 from .optimize import *
--> 390 from ._minimize import *
391 from ._root import *
392 from ._root_scalar import *
~\Anaconda3\lib\site-packages\scipy\optimize\_minimize.py in <module>
28 from ._trustregion_krylov import _minimize_trust_krylov
29 from ._trustregion_exact import _minimize_trustregion_exact
---> 30 from ._trustregion_constr import _minimize_trustregion_constr
31
32 # constrained minimization
~\Anaconda3\lib\site-packages\scipy\optimize\_trustregion_constr\__init__.py in <module>
2
3
----> 4 from .minimize_trustregion_constr import _minimize_trustregion_constr
5
6 __all__ = ['_minimize_trustregion_constr']
~\Anaconda3\lib\site-packages\scipy\optimize\_trustregion_constr\minimize_trustregion_constr.py in <module>
2 import time
3 import numpy as np
----> 4 from scipy.sparse.linalg import LinearOperator
5 from .._differentiable_functions import VectorFunction
6 from .._constraints import (
~\Anaconda3\lib\site-packages\scipy\sparse\linalg\__init__.py in <module>
114 from .dsolve import *
115 from .interface import *
--> 116 from .eigen import *
117 from .matfuncs import *
118 from ._onenormest import *
~\Anaconda3\lib\site-packages\scipy\sparse\linalg\eigen\__init__.py in <module>
9 from __future__ import division, print_function, absolute_import
10
---> 11 from .arpack import *
12 from .lobpcg import *
13
~\Anaconda3\lib\site-packages\scipy\sparse\linalg\eigen\arpack\__init__.py in <module>
20 from __future__ import division, print_function, absolute_import
21
---> 22 from .arpack import *
~\Anaconda3\lib\site-packages\scipy\sparse\linalg\eigen\arpack\arpack.py in <module>
43 __all__ = ['eigs', 'eigsh', 'svds', 'ArpackError', 'ArpackNoConvergence']
44
---> 45 from . import _arpack
46 import numpy as np
47 import warnings
ImportError: DLL load failed: La procédure spécifiée est introuvable.
I have found several threads about this problem but none of them works for me. Apparently there's a problem with arpack in my case. I already tried to uninstal/reinstall numpy, scipy, sklearn, mkl. Nothing is working. Please help
Solution 1:[1]
I've finally found a solution. I reinstalled numpy+mkl. Apparently you have to download it specifically from here.
Then in the Terminal you go to the folder you saved the file and you run the following command:
pip install --upgrade --force-reinstall "numpy-1.18.1+mkl-cp37-cp37m-win_amd64.whl"
(replace the name of the file by the one you have downloaded)
Magic. It's working.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | VideoPac |