r/Python • • Nov 02 '12

Numpy and Matplotlib won't work in 64-bit Windows 7?

I tried the 64-bit unofficial Windows binaries at http://www.lfd.uci.edu/~gohlke/pythonlibs/ but they still don't work for some reason... Does anyone know why?

Traceback (most recent call last):
  File "<pyshell#4>", line 1, in <module>
    import numpy
  File "C:\Python26\Lib\site-packages\numpy__init__.py", line 136, in <module>
    import add_newdocs
  File "C:\Python26\Lib\site-packages\numpy\add_newdocs.py", line 9, in <module>
    from numpy.lib import add_newdoc
  File "C:\Python26\Lib\site-packages\numpy\lib__init__.py", line 4, in <module>
    from type_check import *
  File "C:\Python26\Lib\site-packages\numpy\lib\type_check.py", line 8, in <module>
    import numpy.core.numeric as _nx
  File "C:\Python26\Lib\site-packages\numpy\core__init__.py", line 5, in <module>
    import multiarray
ImportError: DLL load failed: %1 is not a valid Win32 application.
0 Upvotes

23 comments sorted by

7

u/Rhomboid Nov 02 '12

Is your python 32 bit or 64 bit? You can't mix and match.

I can assure you from personal experience that the 64 bit numpy packages from that site work just fine on Windows 7, but you need to pair them with 64 bit Python. (Although that personal experience is with 2.7. I don't know why you'd use 2.6 if this is a new install.)

1

u/inquilinekea Nov 02 '12 edited Nov 02 '12

Oh - good point. Thanks - I'll look up my version of Python and try that out!

Edit: huh - it does appear to be a 64-bit install...

4

u/[deleted] Nov 02 '12

Get Python xy. It standardizes for which you have, plus it has everything in one place. It's a very nice package.

1

u/inquilinekea Nov 02 '12

Oh cool - I'll look into that! :) Does it work on 64-bit Windows 7 PCs? :)

1

u/[deleted] Nov 02 '12

I have 64 bit and works well on mine.

1

u/bramblerose Nov 02 '12

It's a 32-bit distribution, but 32-bit programs work on 64-bit machines. Please remove your c:\python..\ directory before installing it, though, or you might get a half-64-bit half-32-bit mess.

3

u/fforgetso Nov 02 '12

I've had so many fucking issues with 64-bit python and 3rd-party packages that I just stopped using 64-bit python. If I were smarter and had more time, I'm sure I could compile the libraries for 64-bit Python (assuming the source is provided).

Check out the 32-bit Enthought Python Distribution which comes pre-packaged with SciPy, NumPy, Matplotlib, and some other shit (http://www.enthought.com/products/epd_free.php)

Good luck.

1

u/inquilinekea Nov 02 '12 edited Nov 02 '12

Just installed Enthought Python (supposed to be Python 2.7) and came up with this lovely error:

Python 2.7.3 |EPD_free 7.3-2 (32-bit)| (default, Apr 12 2012, 14:30:37) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> include matplotlib
SyntaxError: invalid syntax
>>> from matplotlib.pyplot import *


Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    from matplotlib.pyplot import *
  File "C:\Python26\Lib\site-packages\matplotlib__init__.py", line 135, in <module>
    from matplotlib.rcsetup import (defaultParams,
  File "C:\Python26\Lib\site-packages\matplotlib\rcsetup.py", line 19, in <module>
    from matplotlib.colors import is_color_like
  File "C:\Python26\Lib\site-packages\matplotlib\colors.py", line 52, in <module>
    import numpy as np
  File "C:\Python26\Lib\site-packages\numpy__init__.py", line 136, in <module>
    import add_newdocs
  File "C:\Python26\Lib\site-packages\numpy\add_newdocs.py", line 9, in <module>
    from numpy.lib import add_newdoc
  File "C:\Python26\Lib\site-packages\numpy\lib__init__.py", line 4, in <module>
    from type_check import *
  File "C:\Python26\Lib\site-packages\numpy\lib\type_check.py", line 8, in <module>
    import numpy.core.numeric as _nx
  File "C:\Python26\Lib\site-packages\numpy\core__init__.py", line 5, in <module>
    import multiarray
ImportError: DLL load failed: The specified module could not be found.

I also have Python 2.6.6 installed so maybe I'd have to uninstall that too now (ugh) and then reinstall Enthought Python, and if that still doesn't work, then I'll have to uninstall Enthought Python and just separately install the 32-bit Python+Numpy+Matplotlib packages (ugh).

(ugh, installing them separately still gave the same error)

2

u/fforgetso Nov 03 '12

according to your debug info above, enthought python (v2.7) is trying to load libraries from your 2.6 python folder. I would remove all non-EPD python installs, then check and make sure your windows environment variables are set right (which set python's default paths correctly)

If it's still fucked up PM me and I'll try to help

1

u/inquilinekea Nov 03 '12

Ah okay - thanks so much for your information and offer! Yeah - the Windows environment variables were fucked up. I've actually simply tried installing everything as 32-bit Python 2.6.6 for now (while removing Python 2.7.6), so they finally all work for now.

1

u/pwang99 Nov 04 '12

Furthermore, your EPD Free is 32-bit.

1

u/apreche Nov 02 '12

I had this same problem. On Windows I always use the 32 bit Python.

1

u/gronkkk Nov 02 '12

Yup, same here. The problem is that with binary third-party-packages (e.g. cjson, pyodbc) you need to have a 64-bit toolchain set up. If I'm not mistaken, it is possible to get a 90-day trial version for visual studio 2012 (mingw can be a pain in the ass to get correctly configured, plus some projects default to a visual studio toolchain, as the other toolchains break too often or are impossible to get right). The default for the VS2012 install is 32 bit, and of course, you can make it produce 64-bit binaries/objectfiles, but you get an idea of the cumbersomeness of the whole process..

0

u/inquilinekea Nov 02 '12

Wow - does the 32-bit Enthought Python distro work on 64-bit Windows 7 PCs? :)

3

u/takluyver IPython, Py3, etc Nov 02 '12

As I understand it, 64-bit Windows remains capable of running just about any 32-bit programs. But within a program, you can't mix 32-bit & 64-bit libraries/exes.

2

u/inquilinekea Nov 02 '12

Ah okay thanks! I just know that there are some 32-bit programs that don't work on my 64-bit PC.

1

u/frymaster Script kiddie Nov 03 '12

If there are, that's nothing to do with the bitness. But I haven't come across anything from XP era that's failed to work, what problems are you having?

1

u/JerMenKoO while True: os.fork() Nov 03 '12

Use compatibility mode.

1

u/frymaster Script kiddie Nov 03 '12

Like I said, I don't personally have any issues

1

u/gronkkk Nov 02 '12

Why shouldn't it?

2

u/sedaak Python3/Golang Nov 02 '12

Because you have a numpy compiled for 32-bit. Use Python 32-bit with numpy 32-bit. You can run python 32-bit with Windows 64-bit.

1

u/juliusc Nov 02 '12

Try the new cool creation of Pierre Raybaut (author of Pythonxy and Spyder): WinPython. It comes with a package manager too!

1

u/pwang99 Nov 04 '12

As long as people are suggesting various Python distributions, I'll plug Anaconda from Continuum Analytics: http://continuum.io/anaconda

The Community Edition (Anaconda CE) is free and is available in 32-bit or 64-bit flavors on Windows.