0

I am using windows 7 home basic 64 bit. I wanted to work with FITS file in python 3.3 so downloaded pyfits and numpy for 64 bit. When I import pyfits I get the following error:

Traceback (most recent call last): File "", line 1, in import pyfits as py File "C:\Python33\lib\site-packages\pyfits__init__.py", line 26, in import pyfits.core File "C:\Python33\lib\site-packages\pyfits\core.py", line 38, in
import pyfits.py3compat File "C:\Python33\lib\site-packages\pyfits\py3compat.py", line 12, in import pyfits.util File "C:\Python33\lib\site-packages\pyfits\util.py", line 29, in
import numpy as np File "C:\Python33\lib\site-packages\numpy__init__.py", line 168, in from . import add_newdocs File "C:\Python33\lib\site-packages\numpy\add_newdocs.py", line 13, in from numpy.lib import add_newdoc File "C:\Python33\lib\site-packages\numpy\lib__init__.py", line 8, in from .type_check import * File "C:\Python33\lib\site-packages\numpy\lib\type_check.py", line 11, in import numpy.core.numeric as _nx File "C:\Python33\lib\site-packages\numpy\core__init__.py", line 6, in from . import multiarray ImportError: DLL load failed: %1 is not a valid Win32 application.

ndpu
  • 22,225
  • 6
  • 54
  • 69
Srivatsan
  • 9,225
  • 13
  • 58
  • 83

2 Answers2

1

I'd highly recommend checking out the Enthought python distribution (Canopy), which comes nicely prepackaged with pyfits, numpy, scipy, matplotlib, and a whole mess of other modules. They have binaries which should run out of the box for Windows. https://www.enthought.com/products/canopy/

qmorgan
  • 4,794
  • 2
  • 19
  • 14
  • 1
    While I agree, I don't think answers like this (and they always seem to appear on questions about scientific Python package installation) are useful answers. It's not always a feasible solution, and people *should* be able to install these packages with their system Python if need be. Still definitely worth pointing out though in case anyone is unaware, but I wouldn't call it an "answer" to the actual problem posed. – Iguananaut Dec 11 '13 at 17:06
  • Thanks for the comment-that makes sense. I'm still pretty new to this site and am learning the etiquette, so I appreciate the feedback! I'll keep suggestions like this to comments from now on. – qmorgan Dec 11 '13 at 17:29
  • I'm new-ish too so I don't really know if it's "policy" or not--this is just something I've seen on many questions like this and it developed into a pet peeve :) It's *definitely* good advice, just not a solution to the actual problem per-se ;) – Iguananaut Dec 11 '13 at 17:49
0

This is a problem importing numpy, not pyfits. You can tell because the traceback ended upon trying to import the numpy multiarray module.

This error suggests that the numpy you have installed was not built for the same architecture as your Python installation.

Iguananaut
  • 21,810
  • 5
  • 50
  • 63
  • Thanks for accepting. Though I wonder if this question shouldn't be closed; it seems like it was just a local installation/configuration issue that wouldn't provide useful information to anyone else... – Iguananaut Mar 07 '14 at 21:38