Users of the Anaconda python distribution should follow the instructions
for Using conda.

Note

You will need a C compiler (e.g. gcc or clang) to be installed (see
Building from source below) for the installation to succeed.

Note

The --no-deps flag is optional, but highly recommended if you already
have Numpy installed, since otherwise pip will sometimes try to “help” you
by upgrading your Numpy installation, which may not always be desired.

Note

If you get a PermissionError this means that you do not have the
required administrative access to install new packages to your Python
installation. In this case you may consider using the --user option
to install the package into your home directory. You can read more
about how to do this in the pip documentation.

Alternatively, if you intend to do development on other software that uses
Astropy, such as an affiliated package, consider installing Astropy into a
virtualenv.

Do not install Astropy or other third-party packages using sudo
unless you are fully aware of the risks.

There may be a delay of a day or two between when a new version of Astropy
is released and when a package is available for Anaconda. You can check
for the list of available versions with condasearchastropy.

Note

Attempting to use pip to upgrade your installation of Astropy may result
in a corrupted installation.

Running the tests this way is currently disabled in the IPython REPL due
to conflicts with some common display settings in IPython. Please run the
Astropy tests under the standard Python command-line interpreter.

You will need a compiler suite and the development headers for Python and
Numpy in order to build Astropy.

You will also need Cython (v0.21 or later) and
jinja2 (v2.7 or later) installed
to build from source, unless you are installing a release. (The released
packages have the necessary C files packaged with them, and hence do not require
Cython.)

Astropy uses the Python built-in distutils framework for building and
installing and requires the setuptools package – the later is automatically
downloaded when running pythonsetup.py if it is not already provided by
your system.

If Numpy is not already installed in your Python environment, the
astropy setup process will try to download and install it before
continuing to install astropy.

The Astropy source ships with the C source code of a number of
libraries. By default, these internal copies are used to build
Astropy. However, if you wish to use the system-wide installation of
one of those libraries, you can pass one or more of the
--use-system-X flags to the setup.pybuild command.

Now, quit CASA and re-open it, then type the following to install Astropy:

CASA<2>:importpipCASA<3>:pip.main(['install','astropy','--user'])

Then close CASA again and open it, and you should be able to import Astropy:

CASA<2>:importastropy

Any astropy affiliated package can be installed the same way (e.g. the
spectral-cube or other
packages that may be useful for radioastronomy).

Note

The above instructions have been tested and are known to work on
MacOS X with CASA 4.3.1 and Linux with CASA 4.3.1, 4.4.0, 4.5.3, and
pre-releases of CASA 4.7. However, due to missing header files in
CASA, they are known to not work on Linux with CASA 4.2.1 and
CASA 4.6.0.

Building the documentation is in general not necessary unless you
are writing new documentation or do not have internet access, because
the latest (and archive) versions of astropy’s documentation should
be available at docs.astropy.org .

Building the documentation requires the Astropy source code and some additional
packages: