Python installation
This page describes how to set up a python scientific environment on GNU/Linux, Mac OS X and Window XP/7 based on the version 2.5, 2.6 or 2.7 of python. The following libraries and utilities will be installed:
- Numpy: Array processing, the fundamental package for scientific computing with Python
- Matplotlib: Publication-quality plots, mostly 2D
- Scipy: Mathematics, sciences and engineering library
- STScI python: Astronomical data analysis (includes PyRAF, MultiDrizzle, PyFITS, pysynphot and Numdisplay)
- Ipython: Interactive Python shell
Notes
- This page is adapted from the MIRI software installation notes.
- The prompt notifies if root or non-privileged user account must be used for commands
Location of the Python packages installed either with the distribution package manager (Linux), dmg (Mac), executable (Windows), or with setup.py with administrator privileges and without prefix option:
- Linux:
- Ubuntu: /usr/local/lib/python2.x/dist-packages/
- other distribution: /usr/lib/python2.x/site-packages/
- Windows: C:\Python2xLib\site-packages\
- Mac OS: /usr/stsci/pyssg/2.x.y
- Where x and y are your actual Python version and sub-version numbers.
- Linux:
If you want to read/modify/write some python code, you might want an IDE or at least a good editor. Of course Vim and Emacs can do the job pretty well. For graphical IDEs: eclipse + pydev plugin, Spyder (included in pythonxy on windows) and Eric are available.
GNU/Linux
Install usual python libraries and useful packages
-
Ubuntu:
>>> $user@ubuntu-box: sudo apt-get install ipython python-numpy python-matplotlib python-scipy
>>> $user@ubuntu-box: sudo apt-get install build-essential gfortran python-dev xorg-dev libatlas-base-dev -
Fedora:
>>> #root@fedora-box: yum install ipython numpy python-matplotlib scipy
>>> #root@fedora-box: yum install gcc gcc-gfortran libX11-devel
NOTE: dependencies include atlas, libgfortran, numpy-f2py
Install stsci_python
Get the package at http://stsdas.stsci.edu/download/stsci_python_2.10/stsci_python_2.10.tar.gz
- Uncompress and install:
>>> $user@linux-box: tar -xzf stsci_python_2.10.tar.gz
>>> $user@linux-box: cd stsci_python_2.10
>>> $user@linux-box: sudo python setup.py install or >>> #root@linux-box: python setup.py install
Mac OS X Intel
Install stsci_python
- Download the package at http://stsdas.stsci.edu/download/stsci_python_2.10/stsci_iraf_intel_2.10.dmg
- Install the dmg
Windows XP/7
Install Python(x,y)
- Download the installer at http://www.python-science.org/download/pythonxy/Python(x,y)-2.1.17.exe
- Install the exe
Install stsci_python
- Get the installer at http://stsdas.stsci.edu/download/stsci_python_2.10/stsci_python-2.10.win32-py2.5.exe
- Install the exe
JulienMorin - 04 Nov 2011