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
Related
I'm trying to use the responder package (https://github.com/taoufik07/responder) in a conda environment. But I'm getting the following error:
conda create --name tmp python=3.7
conda activate tmp
conda install -c conda-forge responder
python -c "import responder;"
And then I get this:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/x/opt/anaconda3/envs/dex/lib/python3.7/site-packages/responder/__init__.py", line 1, in <module>
from .core import *
File "/Users/x/opt/anaconda3/envs/dex/lib/python3.7/site-packages/responder/core.py", line 1, in <module>
from .api import API
File "/Users/x/opt/anaconda3/envs/dex/lib/python3.7/site-packages/responder/api.py", line 20, in <module>
from . import models, status_codes
File "/Users/x/opt/anaconda3/envs/dex/lib/python3.7/site-packages/responder/models.py", line 12, in <module>
import graphene
File "/Users/x/opt/anaconda3/envs/dex/lib/python3.7/site-packages/graphene/__init__.py", line 19, in <module>
from .types import (
File "/Users/x/opt/anaconda3/envs/dex/lib/python3.7/site-packages/graphene/types/__init__.py", line 7, in <module>
from .scalars import Scalar, String, ID, Int, Float, Boolean
File "/Users/x/opt/anaconda3/envs/dex/lib/python3.7/site-packages/graphene/types/scalars.py", line 2, in <module>
from graphql.language.ast import (BooleanValue, FloatValue, IntValue,
ImportError: cannot import name 'BooleanValue' from 'graphql.language.ast' (/Users/x/opt/anaconda3/envs/dex/lib/python3.7/site-packages/graphql/language/ast.py)
I think You haven't activated the Conda environment
MANUAL PROCESS
above error is not module error that import error so in that module something is missing go to the site-packages and into that library then check the code
REINSTALLING
remove that library, and re-install through the pip OR below command, check the python version.
$ pipenv install responder
$ pipenv install -e git+https://github.com/taoufik07/responder.git#egg=responder
I just did a conda install of a few packages to follow a tutorial, and now I can't even import pandas.
I installed these:
fake-factory==0.7.2
Faker==0.7.3
pytz==2016.7
tzlocal==1.3.0
And now I get this:
>>> import pandas
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\ProgramData\Anaconda3\envs\ariel\lib\site-packages\pandas\__init__.py", line 42, in <module>
from pandas.core.api import *
File "C:\ProgramData\Anaconda3\envs\ariel\lib\site-packages\pandas\core\api.py", line 7, in <module>
from pandas.core.arrays.integer import (
File "C:\ProgramData\Anaconda3\envs\ariel\lib\site-packages\pandas\core\arrays\__init__.py", line 2, in <module>
from .base import (ExtensionArray, # noqa
File "C:\ProgramData\Anaconda3\envs\ariel\lib\site-packages\pandas\core\arrays\base.py", line 21, in <module>
from pandas.core import ops
File "C:\ProgramData\Anaconda3\envs\ariel\lib\site-packages\pandas\core\ops\__init__.py", line 21, in <module>
from pandas.core.construction import extract_array
File "C:\ProgramData\Anaconda3\envs\ariel\lib\site-packages\pandas\core\construction.py", line 18, in <module>
from pandas.core.dtypes.base import ExtensionDtype, registry
ImportError: cannot import name 'registry' from 'pandas.core.dtypes.base' (C:\ProgramData\Anaconda3\envs\ariel\lib\site-packages\pandas\core\dtypes\base.py)
I tried doing a conda update pandas, but to no avail.
I also just installed luigi, not quite sure when it broke as I installed all the additional packages in one go.
Updated version of pandas package using pip3
try this in python3
pip3 install --upgrade pandas
Try updating pandas package in Anaconda:
conda install pandas=1.1.4
If no luck, try updating all packages:
conda update --all
Worked in my case.
I've installed scipy and statsmodels, but encounter an error when attempting to import statsmodels:
$ pip install scipy
$ pip install statsmodels
$ python
>>> import statsmodels as sm
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/pa354/software/miniconda3/lib/python3.7/site-packages/statsmodels/__init__.py", line 10, in <module>
from statsmodels.tools.sm_exceptions import (ConvergenceWarning, CacheWriteWarning,
File "/home/pa354/software/miniconda3/lib/python3.7/site-packages/statsmodels/tools/__init__.py", line 1, in <module>
from .tools import add_constant, categorical
File "/home/pa354/software/miniconda3/lib/python3.7/site-packages/statsmodels/tools/tools.py", line 8, in <module>
from scipy.linalg import svdvals
ModuleNotFoundError: No module named 'scipy.linalg'
Upgrade to the latest version of scipy with:
$ pip install scipy --upgrade
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.
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