How To Install python-pyfits on Ubuntu 18.04

In this tutorial we learn how to install python-pyfits on Ubuntu 18.04. python-pyfits is Python module for reading, writing, and manipulating FITS files

Introduction

In this tutorial we learn how to install python-pyfits on Ubuntu 18.04.

What is python-pyfits

python-pyfits is:

FITS (Flexible Image Transport System) is a data format most used in astronomy. PyFITS is a Python module for reading, writing, and manipulating FITS files. The module uses Python’s object-oriented features to provide quick, easy, and efficient access to FITS files. The use of Python’s array syntax enables immediate access to any FITS extension, header cards, or data items.

Note that the development of PyFITS has been stopped and will not see any new upstream version. It is superseded by the module astropy.io which is almost a drop-in replacement. PyFITS should therefore only be used for compatibility reasons, astropy should be used instead for new developments.

This package provides PyFITS on the Python 2 module path. It is complemented by python3-pyfits.

There are three methods to install python-pyfits on Ubuntu 18.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install python-pyfits Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install python-pyfits using apt-get by running the following command:

sudo apt-get -y install python-pyfits

Install python-pyfits Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install python-pyfits using apt by running the following command:

sudo apt -y install python-pyfits

Install python-pyfits Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install python-pyfits using aptitude by running the following command:

sudo aptitude -y install python-pyfits

How To Uninstall python-pyfits on Ubuntu 18.04

To uninstall only the python-pyfits package we can use the following command:

sudo apt-get remove python-pyfits

Uninstall python-pyfits And Its Dependencies

To uninstall python-pyfits and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove python-pyfits

Remove python-pyfits Configurations and Data

To remove python-pyfits configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge python-pyfits

Remove python-pyfits configuration, data, and all of its dependencies

We can use the following command to remove python-pyfits configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge python-pyfits

References

Summary

In this tutorial we learn how to install python-pyfits package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.