Astroconda–IRAF install

These instructions should install the Anaconda Python distribution and three separate Anaconda environments:

  1. The Anaconda default (root) environment running Python 3
  2. An AstroConda environment running Python 3
  3. An AstroConda/IRAF environment running Python 2.7. This is because IRAF doesn't "play well" with Python 3.

You can switch environments as needed.

Installation

The following installation instructions is a summary drawn from the Installation Instructions on the Space Telescope Science Institue AstroConda page. Refer to that page for more detailed instructions.

  1. Download Anaconda Graphical Installer (Python 3.6) from Anaconda Download and follow the instructions on that page to install Anaconda. NOTE: When you get to the Destination Select step, be sure to pause and select the Install for me only tab. This will install a directory under your login directory called anaconda. This seems to work better than installing system wide.
  2. Open a terminal window and type which conda. If the installation worked, this should display the path to the conda.
    $ which conda
    /Users/computationalphysics/anaconda/bin/conda
    	
  3. Configure Andaconda to install packages directly from the AstroConda repository.
    $ conda config --add channels http://ssb.stsci.edu/astroconda
    	
  4. Create the Python 3 AstroConda environment.
    $ conda create -n astroconda stsci
    	
    This command will generate some output and then will display the prompt Proceed ([y]/n)?. Just type y or hit <return> to accept the installation. This is a large installation so it may take a few minutes to finish.
  5. Now install the Python 2.7 package with IRAF by using the command:
    $ conda create -n iraf27 python=2.7 iraf-all pyraf-all stsci
    	
    You will again be prompted to proceed with the installation. Again, it's a large amount of code so it will take a few minutes to install.

Working with environments

Installing these environments allows you to use whichever version of Python you need. For general purpose programming the default root environment is probably best. You don't need to do anything to activate the root environment, but to activate the other environments you issue the command source activate environment_name. For example if you wanted to run ipython in the astroconda environment you would use the following commands.

~$ source activate astroconda
(astroconda) ~$ which python
/Users/computationalphysics/anaconda/envs/astroconda/bin/python
(astroconda) ~$ ipython --matplotlib
Python 3.5.2 |Continuum Analytics, Inc.| (default, Jul  2 2016, 17:52:12) 
Type "copyright", "credits" or "license" for more information.

IPython 5.1.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: 

The which python command isn't necessary, but it was included to verify the path to the current environment is correct. The command ipython --matplotlib runs IPython with a switch that sets-up IPython to do interactive plotting.

The command source deactivate deactivates the environment returns the Terminal window to the default root environment.

Warning: Activating an environment in a particular Terminal window only effects that terminal session and programs spawned from that session. All other Terminal windows continue to use the default environment.

The session below illustrates the effect of source deactivate.

(astroconda) ~$ which python
/Users/computationalphysics/anaconda/envs/astroconda/bin/python
(astroconda) ~$ source deactivate
~$ which python
/Users/computationalphysics/anaconda/bin/python
~$ 

Setup to use IRAF

In order to use IRAF you must activate the iraf27 environment. The session below illustrates how to activate iraf27 and set up a new IRAF environment working directory. See the IRAF Tutorial to learn more about using IRAF.

~$ source activate iraf27
(iraf27) ~$ mkdir iraf
(iraf27) ~$ cd iraf
(iraf27) iraf$ mkiraf
-- creating a new uparm directory
Terminal types: xgterm,xterm,gterm,vt640,vt100,etc.
Enter terminal type [default xterm-256color]: xterm
A new LOGIN.CL file has been created in the current directory.
You may wish to review and edit this file to change the defaults.
You may also add additional customizations to loginuser.cl
(iraf27) iraf$ cl
setting terminal type to xterm...

   NOAO/IRAF PC-IRAF Revision 2.16 EXPORT Thu May 24 15:41:17 MST 2012
      This is the EXPORT version of IRAF V2.16 supporting PC systems.


  Welcome to IRAF.  To list the available commands, type ? or ??.  To get
  detailed information about a command, type 'help <command>'.  To run  a
  command  or  load  a  package,  type  its name.   Type  `bye' to exit a
  package, or `logout' to get out  of the CL.    Type `news' to find  out
  what is new in the version of the system you are using.  

  Visit http://iraf.net if you have questions or to report problems.

  The following commands or packages are currently defined:

  (Updated on 2013-12-13)

      adccdrom.   deitab.     kepler.     noao.       sqiid.      vo.
      apropos     esowfi.     language.   obsolete.   stecf.      xdimsum.
      cfh12k.     finder.     lists.      optic.      stsdas.     xray.
      cirred.     fitsutil.   mem0.       plot.       system.     
      ctio.       gemini.     mscdb.      proto.      tables.     
      cutoutpkg.  gmisc.      mscred.     rvsao.      ucsclris.   
      dataio.     guiapps.    mtools.     softools.   upsqiid.    
      dbms.       images.     nfextern.   song.       utilities.  

ecl> 

IRAF should now be running properly. However, if after entering the cl command you get the prompt curdir: instead of the usual "Welcome to IRAF" message see the comment below.

Updating the environments

All of these environments are continually being updated to fix bugs and add features. Each of the environments is updated separately. To update the root environment including the Navigator app use the command conda update anaconda. To update all of the packages in the other two environments use conda update -n environment_name --all, where environment_name is either astroconda or iraf27.


The curdir: error
This error usually occurs when the SHELL environment variable isn't read properly by IRAF. This installation of IRAF requires that SHELL=/bin/bash. The sample session below illustrates the problem and how to fix it.

(iraf27) iraf$ cl
curdir: ^CERROR: interrupt!!!
     called as: `cl ()'
Error while reading login.cl file - may need to rebuild with mkiraf
Fatal startup error.  CL dies.
(iraf27) iraf$ echo $SHELL
bash
(iraf27) iraf$ export SHELL=/bin/bash
(iraf27) iraf$ cl
setting terminal type to xterm-256color...

   NOAO/IRAF PC-IRAF Revision 2.16 EXPORT Thu May 24 15:41:17 MST 2012
      This is the EXPORT version of IRAF V2.16 supporting PC systems.


  Welcome to IRAF.  To list the available commands, type ? or ??.  To get
                                  .
                                  .
                                  .

NOTE: You can abort IRAF at the curdir: prompt by entering <control-C>.