DLL Load Failed: The specified module could not be found [Python] - python

Not sure what the issue is...
...but many of the classifiers will not work on my machine now.
I just installed version 14.1 of scikit-learn. Could this be a path thing?
Traceback (most recent call last):
File "hashtag.py", line 19, in <module>
from sklearn.linear_model import SGDClassifier
File "C:\Anaconda\lib\site-packages\scikit_learn-0.14.1-py2.7-win-amd64.egg\sk
learn\linear_model\__init__.py", line 24, in <module>
from .logistic import LogisticRegression
File "C:\Anaconda\lib\site-packages\scikit_learn-0.14.1-py2.7-win-amd64.egg\sk
learn\linear_model\logistic.py", line 5, in <module>
from ..svm.base import BaseLibLinear
File "C:\Anaconda\lib\site-packages\scikit_learn-0.14.1-py2.7-win-amd64.egg\sk
learn\svm\__init__.py", line 13, in <module>
from .classes import SVC, NuSVC, SVR, NuSVR, OneClassSVM, LinearSVC
File "C:\Anaconda\lib\site-packages\scikit_learn-0.14.1-py2.7-win-amd64.egg\sk
learn\svm\classes.py", line 1, in <module>
from .base import BaseLibLinear, BaseSVC, BaseLibSVM
File "C:\Anaconda\lib\site-packages\scikit_learn-0.14.1-py2.7-win-amd64.egg\sk
learn\svm\base.py", line 8, in <module>
from . import libsvm, liblinear
**ImportError: DLL load failed: The specified module could not be found.**
C:\Users\Owner>
Thank you in advance with your help.

I fixed this with
pip install scipy -U

Maybe there is a bug in the conda recipe / package. You can try to update conda and anaconda with:
conda update conda # update the updater :)
conda update anaconda
If that does not work fix the issue, you can also try:
conda remove scikit-learn
conda install scikit-learn

Related

Using tenorflow and python-not finding modules

When running my python code, i get the following error,
File "run_webcam.py", line 8, in <module>
from tf_pose.estimator import TfPoseEstimator
File __init__.py", line 5, in <module>
from tf_pose.runner import infer, Estimator, get_estimator
File runner.py", line 8, in <module>
from tf_pose import eval
File eval.py", line 14, in <module>
from tf_pose.networks import model_wh, get_graph_path
File networks.py", line 6, in <module>
from tf_pose.network_mobilenet import MobilenetNetwork
File network_mobilenet.py", line 5, in <module>
from tf_pose import network_base
File network_base.py", line 8, in <module>
import tensorflow.contrib.slim as slim
ModuleNotFoundError: No module named 'tensorflow.contrib'
I think that i need to import the dependencies differently as i am using tensorflow 2.0.0 and python 3.7.3.
how do i for example change the slim import to work correctly?
Run following commands to solve this issue:
conda create -n tfpose python=3.6 pip
conda activate tfpose
pip uninstall tensorflow
pip install tensorflow
conda install tensorflow
Now execute your python code.

sklearn: Getting error while importing sklean in jupyter notebook

Importing sklearn gives error in anaconda jupyter notebook. I have installed scikitlearn package and issue is still seen.
Traceback (most recent call last):
File "version.py", line 18, in <module>
import sklearn
File "C:\ProgramData\Anaconda3\lib\site-packages\sklearn\__init__.py", line 13
4, in <module>
from .base import clone
File "C:\ProgramData\Anaconda3\lib\site-packages\sklearn\base.py", line 13, in
<module>
from .utils.fixes import signature
File "C:\ProgramData\Anaconda3\lib\site-packages\sklearn\utils\__init__.py", l
ine 11, in <module>
from .validation import (as_float_array,
File "C:\ProgramData\Anaconda3\lib\site-packages\sklearn\utils\validation.py",
line 18, in <module>
from ..utils.fixes import signature
File "C:\ProgramData\Anaconda3\lib\site-packages\sklearn\utils\fixes.py", line
144, in <module>
from scipy.sparse.linalg import lsqr as sparse_lsqr # noqa
File "C:\ProgramData\Anaconda3\lib\site-packages\scipy\sparse\linalg\__init__.
py", line 118, in <module>
from .matfuncs import *
File "C:\ProgramData\Anaconda3\lib\site-packages\scipy\sparse\linalg\matfuncs.
py", line 19, in <module>
import scipy.special
File "C:\ProgramData\Anaconda3\lib\site-packages\scipy\special\__init__.py", l
ine 640, in <module>
from ._ufuncs import *
ImportError: DLL load failed: The specified procedure could not be found.
(base) C:\Windows\system32>
As referred in this link that looks similar. You probably dont have c++ windows compiler. You will need to install Visual C++ Redistributable and then reinstalling anaconda might solve the issue.
On a side note anaconda generally takes care of the installing of the c++ compiler. Did you create virtualenv and pip install. I will suggest you install using conda install.
conda install scipy

I can`t import scikit -learn on python3. how can i import it?

I installed numpy-1.13.1+mkl-cp36-cp36m-win32 .whl and scipy-0.19.1-cp36-cp36m-win32.whl successfully, then I installed scikit-learn successfully, but when I ran import sklearn,
pycharm gave me errors. How can I remove this problem?
I installed python3.6 (32bit) on windows 10 (64bit).
import sklearn
result of run:
C:\Users\Emertat\AppData\Local\Programs\Python\Python36-32\python.exe "F:/Python/NS videos/cedes/Exercise 07 test.py"
Traceback (most recent call last):
File "F:/Python/NS videos/cedes/Exercise 07 test.py", line 21, in <module>
import sklearn
File "C:\Users\Emertat\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sklearn\__init__.py", line 134, in <module>
from .base import clone
File "C:\Users\Emertat\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sklearn\base.py", line 12, in <module>
from .utils.fixes import signature
File "C:\Users\Emertat\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sklearn\utils\__init__.py", line 11, in <module>
from .validation import (as_float_array,
File "C:\Users\Emertat\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sklearn\utils\validation.py", line 18, in <module>
from ..utils.fixes import signature
File "C:\Users\Emertat\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sklearn\utils\fixes.py", line 144, in <module>
from scipy.sparse.linalg import lsqr as sparse_lsqr # noqa
File "C:\Users\Emertat\AppData\Local\Programs\Python\Python36-32\lib\site-packages\scipy\sparse\linalg\__init__.py", line 117, in <module>
from .matfuncs import *
File "C:\Users\Emertat\AppData\Local\Programs\Python\Python36-32\lib\site-packages\scipy\sparse\linalg\matfuncs.py", line 19, in <module>
import scipy.special
File "C:\Users\Emertat\AppData\Local\Programs\Python\Python36-32\lib\site-packages\scipy\special\__init__.py", line 640, in <module>
from ._ufuncs import *
ImportError: DLL load failed: The specified procedure could not be found.
Process finished with exit code 1
First, Remove the sklearn form your Windows OS by using the following command-
pip uninstall scikit-learn
Then, you need to install numpy and scipy from their own official installers.
Wheel packages (.whl files) for scikit-learn from pypi can be installed with the pip utility. Open a console and type the following to install or upgrade scikit-learn to the latest stable release:
pip install -U scikit-learn
If there are no binary packages matching your python, version you might to try to install scikit-learn and its dependencies from christoph gohlke unofficial windows installers or from a python distribution instead.

This is the error that I am getting while executing from sklearn import preprocessing, cross_validation, svm

Traceback (most recent call last):
File "C:/Python27/12.py", line 4, in <module>
from sklearn import preprocessing, cross_validation, svm
File "C:\Python27\lib\site-packages\sklearn\__init__.py", line 57, in <module>
from .base import clone
File "C:\Python27\lib\site-packages\sklearn\base.py", line 10, in <module>
from scipy import sparse
ImportError: No module named scipy
Please help me resolve this.
Install this package using:
easy_install scipy
or
sudo apt-get install python-scipy
or
pip install scipy
or
conda install scikit-learn
if you are using windows refer:
https://stackoverflow.com/a/39577864/6633975
https://stackoverflow.com/a/32064281/6633975

Error with import sklearn

After installing scikit-learn with pip install -U scikit-learn, I'm not able to call import sklearn:
>>> import sklearn
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\sklearn\__init__.py", line 57, in <module>
from .base import clone
File "C:\Python27\lib\site-packages\sklearn\base.py", line 9, in <module>
from scipy import sparse
File "C:\Python27\lib\site-packages\scipy\sparse\__init__.py", line 214, in <module>
from .csr import *
File "C:\Python27\lib\site-packages\scipy\sparse\csr.py", line 13, in <module>
from ._sparsetools import csr_tocsc, csr_tobsr, csr_count_blocks, \
ImportError: DLL load failed: %1 is not a valid Win32 application.
How can I get over this error?
you could try using Anaconda to create a virtual environment and then install sklearn via conda rather than pip
https://uoa-eresearch.github.io/eresearch-cookbook/recipe/2014/11/20/conda/
http://conda.pydata.org/docs/using/pkgs.html#install-a-package
conda create -n yourenvname python=3.5 anaconda
conda install -n yourenvname sklearn

Categories