When I import sklearn in python shell, I got the following error

ImportError: DLL load failed: The network path was not found.

Here is python version: 3.7.3 64 bit

Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)] on win32

My PC is allocated to students by the university, which is Win10 Edu, 64 bit OS. And I am the administrator

When I was using 32 bit Python, every thing was fine. I changed to 64 bit Python last week because I need to use tensorflow. And then I have problem with sklearn.

Here are the full error message

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
import sklearn
  File "C:\Program Files\Python37\lib\site-packages\sklearn\__init__.py", line 64, in <module>
    from .base import clone
  File "C:\Program Files\Python37\lib\site-packages\sklearn\base.py", line 14, in <module>
    from .utils.fixes import signature
  File "C:\Program Files\Python37\lib\site-packages\sklearn\utils\__init__.py", line 16, in <module>
    from .fixes import _Sequence as Sequence
  File "C:\Program Files\Python37\lib\site-packages\sklearn\utils\fixes.py", line 85, in <module>
    from scipy.special import boxcox  # noqa
  File "C:\Program Files\Python37\lib\site-packages\scipy\special\__init__.py", line 641, in <module>
    from ._ufuncs import *
ImportError: DLL load failed: The network path was not found.

I tried pip list in cmd prompt and I found sklearn (version 0.0)/scikit-learn(version 0.20.3) are both installed.

I searched a lot, but I didn't find anyone having the same problem. I found this question: Error importing sklearn, looks like a different problem to me.

I have reinstall Python, reinstall sklearn (both pip and using wheel), NumPy and SciPy. I unistalled pycharm and anaconda. I also uninstall the Python 2.7 in my pc. None of these worked. Any suggestions are welcomed!

1 Answers

user1988231 On

I faced the exact same error. it seems like sklearn installs wrong version of scipy. you should install sklearn first and then install scipy 1.3.0rc1 and numpy+mkl from Christoph Gohlke windows binaries. https://www.lfd.uci.edu/~gohlke/pythonlibs/