Configuring IDLE and other tools for Python in Virtual Box

Although Python itself is very much portable between Windows, OS X, and Linux machines, many of the libraries we're going to use are only available in different versions and with different capabilities on these platforms. We'd like to avoid platform-related problems for the course, so we'll require that you install a virtual Linux environment. Using one consistent environment for the entire course we can avoid most of the boring problems and concentrate on the meat of the course instead.

1. Install Virtual Box

See Installing Virtual Box for instructions on putting Virtual Box on your machine, if you don't already have it.

2. Install Basic Python Tools and Libraries

You need to install a few important packages for Python that don't come by default on Lubuntu. Click on the "Start Menu" in the lower left corner of the screen, go to "System Tools" and start the "Synaptic Package Manager". You'll have to authenticate with your password again before you can continue. Click on the "Search" button at the top and enter "idle" as your query. Once the search finishes, scroll down the list of results until you find the "idle" package. Click on the box to the left of it and select "Mark for installation". A window will pop up telling you what other packages need to be installed as well in order to install "idle" itself. Simply hit "Okay" to confirm. Then hit the "Apply" button at the top, which will pop up another confirmation dialog where you again hit "Apply" and then you can watch the packages get installed. Once the installation finishes, confirm again with the "Close" button. Then close the "Synaptic Package Manager" since we're done with it for now.

Once again click on the "Start Menu" in the lower left corner of the screen, go to "Programming" and start the "IDLE" application you just installed. The familiar Python development environment from lecture should greet you and you're off to developing Python programs. Woohoo!

3. Additional Python Libraries

Sooner or later we'll need some additional Python libraries that are not installed by default, much like IDLE wasn't installed by default. You can install them the same way as above using the "Synaptic Package Manager" application. Here's a list of those libraries:

pep8
python-matplotlib
python-urllib
python-xlrd
python-xlwt
pygame
numpy

4. Using Lubuntu and Idle after installing

When you restart your virtual box, you can click the Start button (lower left corner) and choose Idle from the Programming Tools menu to work directly with Python. If you want to mess around in unix, you will need to reopen a terminal session to use your Lubuntu installation. In the lower left corner of the virtual box open the main menu -> Accessories -> LXTerminal. Now you're back in your linux environment and can code away. You can access a nice version of emacs through Accessories or the Programming menu options, if you want to try working in something other than idle. In this scenario it's good to work with several open windows - one for editting programs, one for interpreting and running them.

5. Installing IDLE Extensions

We'll be using a few Python programming tools at some point in the semester. Here's how you can install them in Lubuntu for easy use with IDLE. (If you're using Windows or OS X directly without Lubuntu, you're on your own for finding comparable pep8 and doctest installations.)

First, download the cs112idleextensions.tar.gz archive in your virtual box machine (by viewing this page from a browser there and clicking the link). If you're using Chromium as your web browser in Lubuntu, you should find the archive in your Downloads folder. Use the Accessories -> "Archive Manager" to unpack the archive: select the Downloads folder to open it, select the cs112idleextensions.tar.gz file to open it, then select the cs112-idle-extensions folder and choose Extract at the top and then also at the bottom. This should create a new folder called cs112-idle-extensions inside the Downloads folder.

Now comes the tricky part. In the "Start Menu" under "Accessories" (or the "Systems Tools" menu on newer Lubuntu versions), find the "LXTerminal" application and start it. This should open a window with black background - this is a unix shell environment. You will now type several commands into the Terminal window to install the IDLE extensions. First type this command and hit enter:

cd Downloads/cs112-idle-extensions
This will change your "current directory" to the directory you just unpacked the archive into. Now type the following command and hit enter:
sudo bash INSTALL
You will be prompted to enter your password now. When you type your password, no letters or other symbols will appear, but the computer will still read your input. Hit enter when you're done typing your password. If everything goes well, you will get no further output from the installation script. You're done! Close the LXTerminal window and start IDLE. Once you open a Python file, click on the Run menu and you should see two new menu items, one for running the style checker and one for running test cases. Try them both!