0
votes

I have had issues installing the sklearn module in Python Canopy on Windows. I have a separate Python 3.3 and 2.7 (64-bit) installation too. But I have eliminated all the 3.3 env variables, so only 2.7 may be a problem. However any module installed to 2.7 seems to get ignored regardless..

Eventually I thought I solved the issue by copy-pasting the folder into site-packages where Canopy was installed.

This seems to allow me to import sklearn successfully. However it seems that I can't use it when trying this example in IDLE. The error output is included below.

What are the steps I should take to solve this? Does copy-pasting modules generally lead to problems?

UPDATE: ran another script which has these imports (from sklearn.lda import LDA from sklearn.qda import QDA) and it runs... so I really have no idea what's going on still.

Traceback (most recent call last): File "D:/Documents/2013 - 2014/Kaggle/bioresponse/sklearn_test/feature_selection_pipeline.py", line 11, in from sklearn import svm File "C:\Users\N\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.1.0.1371.win-x86_64\lib\site-packages\sklearn\svm__init__.py", line 13, in from .classes import SVC, NuSVC, SVR, NuSVR, OneClassSVM, LinearSVC File "C:\Users\N\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.1.0.1371.win-x86_64\lib\site-packages\sklearn\svm\classes.py", line 1, in from .base import BaseLibLinear, BaseSVC, BaseLibSVM File "C:\Users\N\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.1.0.1371.win-x86_64\lib\site-packages\sklearn\svm\base.py", line 8, in from . import libsvm, liblinear ImportError: DLL load failed: The specified module could not be found.

1
not sure how to improve this question... But I'm adding an update nowdarkace
How to improve the question? What are your env variables? What command are you using to try to install?Jonathan March
Thanks for the response. I don't have time this very second to be specific. But I used an exe to install scikit-learn, which created files in the python27 directory. So I realised that my Canopy install seems to override this for some reason and copy-pasted the files into that directory. It seems to work for other examples, but not this one (the one with the error message I gave you)darkace
In case you used the installer from lfd.uci.edu/~gohlke/pythonlibs/#scikit-learn, it specifically requires numpy-MKL (not the numpy included with Canopy).cgohlke

1 Answers

1
votes

A well-behaved .exe installer (such as http://www.lfd.uci.edu/~gohlke/pythonlibs/#scikit-learn) locates Python from entries in the Windows registry. These registry entries point to the "default Python". You can set (and unset) Canopy as the default Python in the Canopy preferences menu.

Even easier -- the Canopy full installer (available with a Basic subscription or a free academic subscription) includes scikit-learn.