Search code examples
pythonastronomyastropy

Can't import pyspeckit


I have a hard time importing and using pyspeckit. whenever I try to import it this is the error message I get:

  File "/Users/sarelg/Documents/NLR/speckit.py", line 1, in <module>
import pyspeckit
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pyspeckit/__init__.py", line 11, in <module>
from . import spectrum
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pyspeckit/spectrum/__init__.py", line 3, in <module>
from .classes import Spectrum,Spectra,ObsBlock
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pyspeckit/spectrum/classes.py", line 23, in <module>
from . import readers
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pyspeckit/spectrum/readers/__init__.py", line 90, in <module>
from . import fits_reader
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pyspeckit/spectrum/readers/fits_reader.py", line 40, in <module>
scale_action=operator.div, verbose=False, apnum=0, **kwargs):
AttributeError: 'module' object has no attribute 'div'

I think it has something to do with the fact the in python 3.4 there is no div, only truediv and floordiv but even if I change it I get a errors in other places. I haven't found anything to suggest that pyspeckit isn't compatible with python 3.4. Any ideas?


Solution

  • pyspeckit presently does not support python3. For now, you have to use python2.7. If you would like python3 support, help converting the code to be python3 compatible would be welcome!

    (I am the main developer of pyspeckit)

    EDIT: I've raised a corresponding issue for this on github. Some of the work-in-progress is at this pull request, though it is incomplete.