Can't import pyfits on python 3.7.6

1.8k views Asked by At

When I try to import pyfits I get the following message

/home/elihu/anaconda3/lib/python3.7/site-packages/pyfits/__init__.py:22: PyFITSDeprecationWarning: PyFITS is deprecated, please use astropy.io.fits PyFITSDeprecationWarning)  # noqa

Does anybody know how to fix this? I have Ubuntu 20.04.1 LTS focal and Python 3.7.6. Thanks!

1

There are 1 answers

0
Iguananaut On BEST ANSWER

Since it looks like you're using Anaconda, you can run conda install astropy. The original pyfits package was merged into astropy.io.fits so if you have existing code that uses pyfits you can replace the import statement with

import astropy.io.fits as pyfits

without changing much else. Note however that there may be additional deprecated or changed interfaces. PyFITS has not been updated as a separate package in over 5 years.