pyfits not working for windows 64 bit

792 views Asked by At

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.

2

There are 2 answers

1
Iguananaut On BEST ANSWER

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.

3
qmorgan On

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/