Skip to content Skip to sidebar Skip to footer

Error When Trying To Import Sklearn Modules : Importerror: Dll Load Failed: The Specified Module Could Not Be Found

I tried to do the following importations for a machine learning project: from sklearn import preprocessing, cross_validation, svm from sklearn.linear_model import LinearRegression

Solution 1:

This line points to scipy.

from scipy.sparse.linalg import lsqr as sparse_lsqr

You can try:

pip uninstall scipy

pip install scipy

enjoy!

Solution 2:

You should open up "C:\Python27\lib\site-packages\sklearn\utils\fixes.py", and edit the contents. There are two specific changes you should make:

First, copy-and-paste the contents of https://github.com/scikit-learn/scikit-learn/blob/74a9756fa784d1f22873ad23c8b4948c6e290108/sklearn/utils/fixes.py into the file "C:\Python27\lib\site-packages\sklearn\utils\fixes.py".

Second, replace the line if np_version < (1, 12, 0): with if np_version < (1, 12):.

More background info and detail available here, in a great answer from user DSM.

Solution 3:

Reinstallation of scipy, numpy, and scikit-learn packages fixed the error in my case.

Solution 4:

Install this numpy library instead of the one you use:

http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy

I assume you have Intel Math Kernal Libary installed.

Solution 5:

i've found a silly solution, similar to the @saggy ones: iteratively run the script from command line, if compare a "DLL error" look for a package/module/library/wattelapesca name, then pip uninstall thatPackage and re-install it

as a pseudocode:

notWorking = truewhile( nonFunge ){
    run_the_script_from_command_line()
    output = get_last_cmd_output()
    if( "ImportError: DLL load failed: blabla"in output ){
        doomed_package = look_for_package_module_library_wattelapesca(output)
        exec("pip uninstall " + doomed_package )
        exec("pip install " + doomed_package )
    }else# all ok, the script works
         notWorking = false
}

Post a Comment for "Error When Trying To Import Sklearn Modules : Importerror: Dll Load Failed: The Specified Module Could Not Be Found"