Question

I tried to get atpy on python 2.7. I downloaded ATpy0.9.6 from

https://pypi.python.org/pypi/ATpy/0.9.6

then tar it, and run:

cd ATpy0.9.6 sudo python setup.py install

things seemed to work well.

But when I tried to import atpy on python, I got always this error message:

ImportError: No module named astropy.io

More precisely,

>>> import atpy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/atpy/__init__.py", line 1, in <module>
    from .basetable import Table, TableSet, VectorException
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/atpy/basetable.py", line 15, in <module>
    from . import registry
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/atpy/registry.py", line 164, in <module>
    from . import fitstable
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/atpy/fitstable.py", line 8, in <module>
    from astropy.io import fits
ImportError: No module named astropy.io
>>> 

Could anyone help me to figure out the problem?

Was it helpful?

Solution

Perhaps the 'atpy' package depends on another package called 'astropy.io' that you are missing? Yes here it is https://astropy.readthedocs.org/en/v0.1/index.html

It happens that downloading the tar balls from pypi.python.org is the wrong way to install Python packages. The right way (though the Python docs explain poorly), is to run a command like

pip install atpy

This command will install your package and all its dependencies.

If the command pip is missing, you have to install it, which is ironically really complicated.

OTHER TIPS

In my case the solution was to install astropy

pip install --no-deps astropy

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top