1.. _build: 2 3Building/installing the Astrometry.net code 4=========================================== 5 6Grab the code:: 7 8 wget http://astrometry.net/downloads/astrometry.net-latest.tar.gz 9 tar xvzf astrometry.net-latest.tar.gz 10 cd astrometry.net-* 11 12Build it. The short version:: 13 14 make 15 make py 16 make extra 17 make install # to put it in /usr/local/astrometry 18 # or: 19 make install INSTALL_DIR=/some/other/place 20 21 22The long version: 23 24Prerequisites 25------------- 26 27For full functionality, you will need: 28 * GNU build tools (gcc/clang, make, etc.) 29 * cairo 30 * netpbm 31 * libpng 32 * libjpeg 33 * libz 34 * bzip2 35 * python (3.x preferred) 36 * numpy 37 * swig (>= 2.0) 38 * fitsio https://github.com/esheldon/fitsio or astropy http://www.astropy.org/ or pyfits: http://www.stsci.edu/resources/software_hardware/pyfits (version >= 3.1) 39 * cfitsio: http://heasarc.gsfc.nasa.gov/fitsio/ 40 41 42Ubuntu or Debian-like systems: 43^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 44 45:: 46 47 48 $ sudo apt-get install libcairo2-dev libnetpbm10-dev netpbm \ 49 libpng2-dev libjpeg-dev python-numpy \ 50 python-pyfits python-dev zlib1g-dev \ 51 libbz2-dev swig cfitsio-dev 52 53 54For example, in Debian 9 (Stretch):: 55 56 $ sudo apt-get install libcairo2-dev libnetpbm10-dev netpbm \ 57 libpng-dev libjpeg-dev python-numpy \ 58 python-pyfits python-dev zlib1g-dev \ 59 libbz2-dev swig libcfitsio-dev 60 61In Ubunutu 20.04:: 62 63 $ sudo apt install build-essential curl git file pkg-config swig \ 64 libcairo2-dev libnetpbm10-dev netpbm libpng-dev libjpeg-dev \ 65 zlib1g-dev libbz2-dev libcfitsio-dev wcslib-dev \ 66 python3 python3-pip python3-distutils python3-dev \ 67 python3-numpy python3-scipy python3-pil 68 69As of April 2019, the script doc/install_astrometry_on_linux.sh will install all dependencies along with astrometry.net on Linux, and download 4200/ index files. 70 71 72CentOS 6.5 / Fedora / RedHat / RHEL -- Detailed Instructions: 73^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 74 75See these `instructions from James Chamberlain <http://plaidhat.com/code/astrometry.php>`_. 76 77 78Arch Linux 79^^^^^^^^^^ 80 81A package can be installed from the `Arch Linux (AUR) 82<https://aur.archlinux.org/packages/astrometry.net/>`_. 83 84 85Mac OS X using homebrew: 86^^^^^^^^^^^^^^^^^^^^^^^^ 87 88These instructions *Worked For Me* as of September 2012 on OSX 10.8. 89 90First set up homebrew: 91 * grab `XCode <https://developer.apple.com/xcode/>`_ (from the Apps Store. Free, but you still need a credit card. Argh.) 92 * grab `XCode Command-line utilities <https://developer.apple.com/downloads/index.action>`_ 93 * grab `XQuartz <http://xquartz.macosforge.org/landing/>`_ 94 * grab `Homebrew <http://mxcl.github.com/homebrew/>`_ 95 * grab `pip <http://www.pip-installer.org/en/latest/installing.html>`_ if you don't have it already 96 97Get homebrew dependencies that need special instructions:: 98 99 $ brew install --HEAD --use-gcc netpbm 100 101Optionally, grab some other handy homebrew packages:: 102 103 $ brew install cfitsio --with-examples 104 $ brew install md5sha1sum # OSX doesn't come with this?! For shame 105 106Get our fork of homebrew-science and install:: 107 108 $ brew tap homebrew/homebrew-science 109 $ brew install astrometry-net 110 111Or:: 112 113 $ brew install --HEAD astrometry.net 114 115if you like to live dangerously (but trendily). 116 117 118Mac OS X using Fink: 119^^^^^^^^^^^^^^^^^^^^ 120 121Use apt-get install as per the Debian instructions above (leaving out 122``zlib1g-dev`` because it's already included with OSX). Note that to 123use Fink you will need to add something like this in your 124``~/.profile`` or ``~/.bashrc`` file:: 125 126 . /sw/bin/init.sh 127 export CFLAGS="-I/usr/local/include -I/sw/include" 128 export LDFLAGS="-L/usr/local/lib -L/sw/lib" 129 130Getting/Building 131---------------- 132 133If you don't have and can't get these libraries, you should still be 134able to compile and use the core parts of the solver, but you will 135miss out on some eye-candy. 136 137Build the solving system:: 138 139 $ make 140 141If you installed the libraries listed above, build the plotting code:: 142 143 $ make extra 144 145Install it:: 146 147 $ make install 148 149You might see some error message during compilation; see the section 150ERROR MESSAGES below for fixes to common problems. 151 152By default it will be installed in ``/usr/local/astrometry`` . 153You can override this by either: 154 155* editing the top-level Makefile (look for INSTALL_DIR); or 156* defining INSTALL_DIR on the command-line: 157 158 For bash shell:: 159 160 $ export INSTALL_DIR=/path/to/astrometry 161 $ make install 162 163 or:: 164 165 $ INSTALL_DIR=/path/to/astrometry make install 166 167 For tcsh shell:: 168 169 $ setenv INSTALL_DIR /path/to/astrometry 170 $ make install 171 172The astrometry solver is composed of several executables. You may 173want to add the INSTALL_DIR/bin directory to your path: 174 175 For bash shell:: 176 177 $ export PATH="$PATH:/usr/local/astrometry/bin" 178 179 For tcsh shell:: 180 181 $ setenv PATH "$PATH:/usr/local/astrometry/bin" 182 183Some of the scripts are written in Python and are run using the `python` from the user's environment via `env python`. 184To override this and use a python executable of your choice, you can use the `PYTHON_SCRIPT` variable, eg,:: 185 186 $ make install INSTALL_DIR=/your/install/directory PYTHON_SCRIPT="/usr/bin/env python3.6"' 187 188or:: 189 190 $ make install INSTALL_DIR=/your/install/directory PYTHON_SCRIPT="/usr/local/bin/python3.6"' 191 192 193Auto-config 194----------- 195 196We use a do-it-yourself auto-config system that tries to detect what 197is available on your machine. It is called ``os-features``, and it 198works by trying to compile, link, and run a number of executables to 199detect: 200 201 * whether the "netpbm" library is available 202 * whether certain GNU-specific function calls exist 203 204You can change the flags used to compile and link "netpbm" by either: 205 206* editing util/makefile.netpbm 207* setting NETPBM_INC or NETPBM_LIB, like this:: 208 209 $ make NETPBM_INC="-I/tmp" NETPBM_LIB="-L/tmp -lnetpbm" 210 211You can see whether netpbm was successfully detected by:: 212 213 $ cat util/makefile.os-features 214 # This file is generated by util/Makefile. 215 HAVE_NETPBM := yes 216 217You can force a re-detection either by deleting util/makefile.os-features 218and util/os-features-config.h, or running:: 219 220 $ make reconfig 221 222(which just deletes those files) 223 224 225Overriding Things 226----------------- 227 228For most of the libraries we use, there is a file called 229``util/makefile.*`` where we try to auto-configure where the headers 230and libraries can be found. We use ``pkg-config`` when possible, but 231you can override things. 232 233``*_INC`` are the compile flags (eg, for the include files). 234 235``*_LIB`` is for libraries. 236 237``*_SLIB``, when used, is for static libraries (.a files). 238 239gsl: 240^^^^ 241 242You can either use your system's GSL (GNU scientific library) 243libraries, or the subset we ship. (You don't need to do anything 244special to use the shipped version.) 245 246System:: 247 248 make SYSTEM_GSL=yes 249 250Or specify static lib:: 251 252 make SYSTEM_GSL=yes GSL_INC="-I/to/gsl/include" GSL_SLIB="/to/gsl/lib/libgsl.a" 253 254Or specify dynamic lib:: 255 256 make SYSTEM_GSL=yes GSL_INC="-I/to/gsl/include" GSL_LIB="-L/to/gsl/lib -lgsl" 257 258 259 260cfitsio: 261^^^^^^^^ 262 263For dynamic libs:: 264 265 make CFITS_INC="-I/to/cfitsio/include" CFITS_LIB="-L/to/cfitsio/lib -lcfitsio" 266 267Or for static lib:: 268 269 make CFITS_INC="-I/to/cfitsio" CFITS_SLIB="/to/cfitsio/lib/libcfitsio.a" 270 271 272netpbm: 273^^^^^^^ 274 275:: 276 277 make NETPBM_INC="-I/to/netpbm" NETPBM_LIB="-L/to/netpbm/lib -lnetpbm" 278 279wcslib: 280^^^^^^^ 281 282Ditto, with ``WCSLIB_INC``, ``WCSLIB_LIB``, ``WCS_SLIB`` 283 284cairo: 285^^^^^^ 286 287``CAIRO_INC``, ``CAIRO_LIB`` 288 289jpeg: 290^^^^^ 291 292``JPEG_INC``, ``JPEG_LIB`` 293 294png: 295^^^^ 296 297``PNG_INC``, ``PNG_LIB`` 298 299 300zlib: 301^^^^^ 302 303``ZLIB_INC``, ``ZLIB_LIB`` 304 305