Python Setup Page

General laptop readiness

We do not need participants to have high-quality computers. What we need is for participants to come with appropriate developer software running on their computers, if possible, because the computers will be used for exercises.

If you have a Windows laptop, we would appreciate feedback on whether these instructions (below) can be easily followed, or how the functional test is executed.

If you have a Mac OS-X laptop, you need to have the xcode developer tools installed. These came on a CD with the laptop, or can be downloaded from the Apple Developer site if you are running the latest version of OS-X. You will know that they are installed if you can type "make" at a terminal prompt and have it say something other than "command not found".

Linux boxes come with most things we need installed already.

Installing Python, Scipy and Numpy

  • Please note that the minimum versions of the packages that you will need are:
    • python-2.6 or later
    • numpy-1.5.1 or later
    • scipy-0.8.0 or later

  • If you do not already have it installed, download and install [ http://python.org/ python]. Please ensure that the python version installed, and used by numpy/scipy.matplotlib is consistent. The included scripts have been tested on python version 2.6. On a Mac, Unix, or Linux box, make sure that python is in your path; that is, make sure that you can type "python" at the prompt in a terminal or shell and have it show you the python prompt.

Installing via Enthough Python Distribution

You could also use a distribution from Enthought, which already includes packages numpy, scipy and matplotlib. The download website is at http://www.enthought.com/products/edudownload.php

Documentation

Functional test

  • Download the test package and extract it in some directory.

  • On a Mac, UNIX or Linux box, if your python installation is not started with the command "python" in the terminal, you should redefine the "python" variable in the Makefile.

  • On a Mac, UNIX or Linux box, you can execute the functional test by executing the command "make" in the directory created by the tar command above. On a windows box, you can run "python func_test.py" to run the functional test.

  • The functional test should produce some tables and two figures. The figures are generated as PNG files and should look like the figures below. If you get an error, take a look at the FAQ below. If that does not help, contact neale dot gibson at astro dot ox dot ac dot uk.

FAQ

  • Q: The Makefile exits with an error message: make: * [data_yerr.png] Error 1
  • A: If the makefile does not work for one reason or another; try executing 'python func_test.py' command in the terminal instead.This command will generate the desired images if the system has been correctly setup.:

  • Q: The code exits with an error such as " ValueError: setting an array element with a sequence".
  • A: Your scipy version is out of date. Make sure you have the latest version installed.

  • Q: I get a long error message that ends in " RuntimeError: Could not obtain dvipng version"
  • A: Either LaTeX is not installed or not installed correctly, or your LaTeX installation did not come with 'dvipng'. Try installing whichever of these is necessary. A similar error occurs with Texlive.

  • Q: Cannot get Enthought Python Distribution to install on Ubuntu.
  • A: Right click on the downloaded file and go to properties. In the permissions tab and check the execute box. If you close that window and try to run the file again, you should get an option “Run in Terminal”.

  • Q: Python components are not installing properly on Ubuntu.
  • A: Try installing Python components via Ubuntu Software installer.

Generated figures

  • data_allerr.png:
    data_allerr.png

  • data_yerr.png:
    data_yerr.png
-- AmyMcQuillan - 22 Feb 2012

-- EdwardGillen - 22 Feb 2012

-- SuzanneAigrain - 22 Feb 2012
I Attachment Action Size Date Who Comment
Matplotlib.pdfpdf Matplotlib.pdf manage 8 MB 22 Feb 2012 - 17:25 SuzanneAigrain  
PythonTest.zipzip PythonTest.zip manage 10 K 22 Feb 2012 - 17:16 SuzanneAigrain  
data_allerr.pngpng data_allerr.png manage 37 K 22 Feb 2012 - 17:17 SuzanneAigrain  
data_yerr.pngpng data_yerr.png manage 13 K 22 Feb 2012 - 17:17 SuzanneAigrain  
Topic revision: r5 - 22 Feb 2012, SuzanneAigrain
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback