PyRAF is a Python wrapper around IRAF, which under MacOS X in Astrophysics used to be provided by the SciSoft suite. This has now been replaced.

WARNING: this page details usage of the Scisoft IRAF. Please instead see:

If you can still see this paragraph, proceed with care.

Please see also:

First time:

Before you start using, PyRAF, you will need to first ensure that the underlying IRAF is set up properly. You can do this as follows:

mkdir iraf
cd iraf

.... then say "xgterm" when asked which terminal type to use. Either of these methods will set up login.cl, your IRAF startup file, which subsequent incarnations of IRAF (thence PyRAF) should be able to see even if ~/iraf/ isn't your current directory.



A Python spaceship should then open in Dock, followed by an avalanche of small announcement windows; then you should get the IRAF command-line opening announcements, followed by a command prompt, in your Terminal (orxterm) window. Once you've finished, exit by using the IRAF command:


.... after which the spaceship should go away, and you get your shell prompt back.

Bonus software:

  • A freestanding 64-bit build of IRAF v2.16.1 is available for installation. This lifts certain size-related limits which some users of SciSoft's IRAF (and PyRAF) have been experiencing.

    Once this has been installed from the Astrophysics category of Self-Service, saying:

    Activate iraf

    .... at the shell prompt first Activates SciSoft as before, then layers the new IRAF on top of it, such that PyRAF uses the new IRAF in preference to SciSoft's instance.

    If you need to use the older version, say instead:

    Activate scisoft

    .... in a clean shell as before, and please let us know (by e-mail to the usual address, or by leaving a comment via the link at the foot of this page) which bugs require you to do so.


PyRAF is intentionally rather stricter than IRAF in the input language that it will accept. In particular, syntax errors or other problems in configuration files such as login.cl can appear in a direct IRAF session to not be immediately fatal, but can cause PyRAF to complain (in loving but not particularly helpful detail) and expire on the spot, without giving you a chance to give it any commands to help find out what you've done wrong.

Perhaps a more charitable way of looking at this is that IRAF is being over-helpful in carrying on regardless, and that PyRAF is doing you a good turn by not silently introducing subtle setup bugs. Such things have a habit of waiting for the kind attention of one's external examiner, or of the reviewers of one's paper for a Learned Journal, before manifesting themselves.

This is agreed to be at best frustrating.

  • Don't assume the problem is with the first (or last) Python module named in the error avalanche. This is often PyRAF's way of saying "IRAF threw an error I don't understand".

    • "Parent module 'pyraf' not found" is a bit of a giveaway, but may be difficult to see under said avalanche.

  • You might have an outdated login.cl, notably if the last time you initialised IRAF was before SciSoft was last updated, or your system has been moved to the new MacOS X system setup. (Hint: login.cl contains the version number of the then-relevant IRAF, and the absolute pathname of your home directory. The latter will differ between desktop systems, where your home directory is on the fileserver, and laptops, where it will be local.)

    • Try going through the setting-up procedure again.

    • It's also possible to run into this sort of problem if you copy your entire ~/iraf/ directory to or from your laptop, even if the versions of (and corrective patches to) IRAF are the same. So don't do that; or if you must do it, do it with all due care and diligence (hint: cp -p login.cl login.cl.laptop).

  • If login.cl exists in the current directory, this will (I think) be read in preference to ~/iraf/login.cl under your home directory; but it's possible this local copy is out of date.

    • Rename it aside, then try again.

    • If it turns out you do need a local copy of login.cl after all, there may well be other problems that aren't as obviously and immediately fatal. Please contact IT Support at the usual e-mail address.

  • If the file ~/iraf/loginuser.cl exists, this is used to customise IRAF on a per-user basis. This will need to be checked for problems: some suggested customisations may be workarounds for bugs or shortcomings in a previous IRAF setup which have since been fixed, and might now be doing more harm than good.

    • Rename the file aside, then see if PyRAF launches successfully.

    • If it does, check whether you still need (some or all of) those customisations.

    • If you do, copy the file back, then comment things out (rather than cutting them out) until PyRAF launches successfully; then work forwards from there.

Please see also:

Categories: Apple | Astro software | Astrophysics | IRAF | Mac | OS X | PyRAF