-1

I have Windows 8 (sadly I was lucky enough to but a laptop that support very badly Linux, tried several distributions..). I have Python 2.7 installed, and also can import scipy and numpy. I've installed astropy with the executable file from their site, but when I try to import it I get the error message down below.

Enthought Canopy Python 2.7.3 | 64-bit | (default, Jun 14 2013, 18:19:25) [MSC v
.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import astropy
Error in sys.excepthook:
Traceback (most recent call last):
  File "C:\Users\Omer\AppData\Local\Enthought\Canopy\User\lib\site-packages\astr
opy\logger.py", line 222, in _excepthook
    self.error(message)
  File "C:\Users\Omer\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.0.3.12
62.win-x86_64\lib\logging\__init__.py", line 1166, in error
    self._log(ERROR, msg, args, **kwargs)
  File "C:\Users\Omer\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.0.3.12
62.win-x86_64\lib\logging\__init__.py", line 1258, in _log
    self.handle(record)
  File "C:\Users\Omer\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.0.3.12
62.win-x86_64\lib\logging\__init__.py", line 1268, in handle
    self.callHandlers(record)
  File "C:\Users\Omer\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.0.3.12
62.win-x86_64\lib\logging\__init__.py", line 1308, in callHandlers
    hdlr.handle(record)
  File "C:\Users\Omer\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.0.3.12
62.win-x86_64\lib\logging\__init__.py", line 748, in handle
    self.emit(record)
  File "C:\Users\Omer\AppData\Local\Enthought\Canopy\User\lib\site-packages\astr
opy\logger.py", line 339, in _stream_formatter
    color_print(record.levelname, 'red', end='')
  File "C:\Users\Omer\AppData\Local\Enthought\Canopy\User\lib\site-packages\astr
opy\utils\console.py", line 230, in color_print
    if isatty(file) and USE_COLOR():
  File "C:\Users\Omer\AppData\Local\Enthought\Canopy\User\lib\site-packages\astr
opy\config\configuration.py", line 336, in __call__
    sec = get_config(self.module)
  File "C:\Users\Omer\AppData\Local\Enthought\Canopy\User\lib\site-packages\astr
opy\config\configuration.py", line 402, in get_config
    from ..utils import find_current_module
SystemError: Parent module 'astropy' not loaded, cannot perform relative import

Original exception was:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Omer\AppData\Local\Enthought\Canopy\User\lib\site-packages\astr
opy\__init__.py", line 136, in <module>
    from .utils import _compiler
ImportError: DLL load failed: %1 is not a valid Win32 application.
>>>

Can anyone help me with setting it up properly?

MSeifert
  • 145,886
  • 38
  • 333
  • 352
Ohm
  • 2,312
  • 4
  • 36
  • 75
  • Did you install 32-bit or 64-bit Python? – Blender Aug 26 '13 at 11:08
  • 1
    You should put the error message directly into the question, otherwise the question will be of no use once the linked file is deleted. – flornquake Aug 26 '13 at 11:39
  • I've installed 64-bit Python – Ohm Aug 26 '13 at 18:24
  • The real issue is the `from .utils import _compiler ImportError: DLL load failed: %1 is not a valid Win32 application`. The `_compiler` module is a DLL. I'm not sure of the specifics, but the Astropy executable installers were built on Windows 7, and it's possible that there's some binary incompatibility here, though I'm not sure what that would be. You should just try installing from source--I think Canopy includes pip. – Iguananaut Sep 03 '13 at 15:27

1 Answers1

1

It looks like you are using Enthought Canopy? Try installing the Anaconda Python Distribution instead (https://store.continuum.io/cshop/anaconda/) as it includes Astropy by default.

astrofrog
  • 32,883
  • 32
  • 90
  • 131