0

I'm running into errors importing a library in python. Here are the details.

I'm running Windows 7 (64 bit), python 2.7.10 (64 bit), and have installed a few 64 bit packages from http://www.lfd.uci.edu/~gohlke/pythonlibs/ Using the standard "pip install ***.whl".

Everything has been working fine for months. Today, (after a windows update), I get an error with a specific import.

>>> import sklearn  # No problem here!
>>> import sklearn.cross_validation
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\sklearn\cross_validation.py", line25, in <module>
    from .utils import indexable, check_random_state, safe_indexing
  File "C:\Python27\lib\site-packages\sklearn\utils\__init__.py", line 16, in <module>
    from .class_weight import compute_class_weight, compute_sample_weight
  File "C:\Python27\lib\site-packages\sklearn\utils\class_weight.py", line 7, in <module>
    from ..utils.fixes import in1d
  File "C:\Python27\lib\site-packages\sklearn\utils\fixes.py", line 318, in <module>
    from scipy.sparse.linalg import lsqr as sparse_lsqr
  File "C:\Python27\lib\site-packages\scipy\sparse\linalg\__init__.py", line 109, in <module>
    from .isolve import *
  File "C:\Python27\lib\site-packages\scipy\sparse\linalg\isolve\__init__.py", line 6, in <module>
    from .iterative import *
  File "C:\Python27\lib\site-packages\scipy\sparse\linalg\isolve\iterative.py", line 7, in <module>
    from . import _iterative
ImportError: DLL load failed: %1 is not a valid Win32 application.

"Not a valid win32 application" leads me to believe that something in the dependencies is installed as a 32 bit library.

To tackle this, I reinstalled scipy, sklearn, numpy, and pandas (all 64 bit). Still the same error.

Then I tried reinstalling everything- completely removing python and reinstalling with all the packages. Still the same error.


Here is the output of "pip list"

C:\windows\system32>pip list
-registry-path (1.0)
appinst (2.1.2)
apptools (4.2.1)
backports.ssl-match-hostname (3.2a3)
Canopy (1.4.1.dev6709)
casuarius (1.1)
chaco (4.4.1)
cloud (2.4.6)
configobj (5.0.5)
coverage (3.7.1)
csvkit (0.9.0)
dbf (0.94.003)
distribute (0.6.49)
docutils (0.11)
enable (4.4.1)
enaml (0.9.5)
encore (0.5.1)
enstaller (4.6.5)
envisage (4.4.0)
esky (0.9.8dev)
etsproxy (0.1.2)
Examples (7.3)
faulthandler (2.0)
feedparser (5.1.3)
googlemaps (1.0.2)
grits-client (0.1)
idle (2.7.3)
ipdb (0.8)
ipython (2.1.0)
jdcal (1.0)
Jinja2 (2.7.3)
jsonpickle (0.4.0)
Jug (1.0.1)
kernmagic (0.2.0)
keyring (3.6dev)
MarkupSafe (0.18)
matplotlib (1.3.1)
MKL (10.3)
mock (1.0.1)
nose (1.3.0)
numpy (1.8.0)
openpyxl (2.1.0)
pandas (0.14.0)
PIL (1.1.7)
pip (1.5.6)
ply (3.4)
psutil (1.2.1)
pyaudio (0.2.4)
pyface (4.4.0)
pyflakes (0.4.5.dev80)
pyglet (1.1.4)
Pygments (1.6.0)
pyparsing (2.0.2)
pyreadline (1.7.1)
PySide (1.2.2)
python-dateutil (2.2.0)
PythonDoc (2.7.3)
pytz (2013.8.0)
pywin32 (218.4.0)
pyzmq (14.1.1)
redis (2.10.3)
requests (2.3.0)
scipy (0.14.0)
six (1.7.2)
SQLAlchemy (0.9.7)
supplement (0.5dev.dev202)
sympy (0.7.5)
Theano (0.7.0)
tornado (3.1.1)
traits (4.5.0)
traitsui (4.4.0)
wsgiref (0.1.2)
wxPython (2.8.10.1)
xlrd (0.9.3)

What could be causing this?

nfmcclure
  • 3,011
  • 3
  • 24
  • 40
  • [This question](http://stackoverflow.com/questions/30421187/unable-to-load-iris-dataset-using-sklearn) may be helpful. The asker said it was a PATH issue but doesn't say exactly what he did to fix it. – BrenBarn Oct 28 '15 at 20:09
  • How did you install it? With pip or with windows installers? I think that you installed unofficial 64 bit build of scipy (with windows installers), and this may cause issue. Try to remove them and install scipy and numpy with pip package manager. Also, i didn't use python on windows, but many peoples say that it's better to use anaconda distribution there, if nothing helps you can try it, it's free for non-commercial usage. – Ibraim Ganiev Oct 29 '15 at 10:21
  • After more looking around, it turned out that I had the "vanilla" version of numpy installed, whereas windows needs the "+MKL". I'm still not sure how this changed suddenly after months of working though. Thanks for all the replies. – nfmcclure Oct 29 '15 at 16:49

0 Answers0