1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
|
************
Installation
************
Requirements
============
Photutils has the following strict requirements:
* `Python <https://www.python.org/>`_ 3.11 or later
* `NumPy <https://numpy.org/>`_ 1.25 or later
* `Astropy`_ 5.3 or later
* `SciPy <https://scipy.org/>`_ 1.11.1 or later
Photutils also optionally depends on other packages for some features:
* `Matplotlib <https://matplotlib.org/>`_ 3.8 or later: Used to power a
variety of plotting features (e.g., plotting apertures).
* `Regions <https://astropy-regions.readthedocs.io/>`_ 0.9 or
later: Required to perform aperture photometry using region objects.
* `scikit-image <https://scikit-image.org/>`_ 0.21 or later: Required
to deblend segmented sources.
* `GWCS <https://gwcs.readthedocs.io/en/stable/>`_ 0.20 or later:
Required in `~photutils.datasets.make_gwcs` to create a simple celestial
gwcs object.
* `Bottleneck <https://github.com/pydata/bottleneck>`_: 1.3.6 or later:
Improves the performance of sigma clipping and other functionality that
may require computing statistics on arrays with NaN values.
* `tqdm <https://tqdm.github.io/>`_: 4.65 or later: Required to display
optional progress bars.
* `Rasterio <https://rasterio.readthedocs.io/en/stable/>`_: 1.3.7 or
later: Required to convert source segments into polygon objects.
* `Shapely <https://shapely.readthedocs.io/en/stable/>`_: 2.0.0 or
later: Required to convert source segments into polygon objects.
Installing the latest released version
======================================
Using pip
---------
To install Photutils with `pip`_, run::
pip install photutils
If you want to install Photutils along with all of its optional
dependencies, you can instead run::
pip install "photutils[all]"
In most cases, this will install a pre-compiled version (called a wheel)
of Photutils, but if you are using a very recent version of Python
or if you are installing Photutils on a platform that is not common,
Photutils will be installed from a source file. In this case you will
need a C compiler (e.g., ``gcc`` or ``clang``) to be installed for the
installation to succeed (see :ref:`building_source` prerequisites).
Using conda
-----------
Photutils can also be installed using the ``conda`` package manager.
There are several methods for installing ``conda`` and many different
ways to set up your Python environment, but that is beyond the
scope of this documentation. We recommend installing `miniforge
<https://github.com/conda-forge/miniforge>`__.
Once you have installed ``conda``, you can install Photutils using the
``conda-forge`` channel::
conda install -c conda-forge photutils
.. _building_source:
Building from Source
====================
Prerequisites
-------------
You will need a compiler suite and the development headers for Python
and Numpy in order to build Photutils from the source distribution. You
do not need to install any other specific build dependencies (such as
Cython) since these will be automatically installed into a temporary
build environment by `pip`_.
On Linux, using the package manager for your distribution will usually be
the easiest route.
On macOS you will need the `XCode`_ command-line tools, which can be
installed using::
xcode-select --install
Follow the onscreen instructions to install the command-line tools
required. Note that you do not need to install the full `XCode`_
distribution (assuming you are using MacOS X 10.9 or later).
Installing the development version
----------------------------------
Photutils is being developed on `GitHub`_. The latest development
version of the Photutils source code can be retrieved using git::
git clone https://github.com/astropy/photutils.git
Then to build and install Photutils (with all of its optional
dependencies), run::
cd photutils
pip install ".[all]"
Alternatively, `pip`_ can be used to retrieve and install the latest
development wheel (with all optional dependencies)::
pip install --upgrade --extra-index-url https://pypi.anaconda.org/astropy/simple "photutils[all]" --pre
Testing an installed Photutils
==============================
To test your installed version of Photutils, you can run the test suite
using the `pytest`_ command. Running the test suite requires installing
the `pytest-astropy <https://github.com/astropy/pytest-astropy>`_ (0.11
or later) package.
To run the test suite, use the following command::
pytest --pyargs photutils
Any test failures can be reported to the `Photutils issue tracker
<https://github.com/astropy/photutils/issues>`_.
.. _pip: https://pip.pypa.io/en/latest/
.. _GitHub: https://github.com/astropy/photutils
.. _Xcode: https://developer.apple.com/xcode/
.. _pytest: https://docs.pytest.org/en/latest/
|