Here are some ways to get started with Python, either online or by installing it on your own computer. The two recommended options are to use the online servers provided or to install Anaconda on your own machine.

CodeLab

Registration

  1. Go to https://codelab4.turingscraft.com/register
  2. Follow the directions, including verifying that you’re not a robot and that your email address is valid. enter your @mcmaster.ca email address, not your personal email address! Your CodeLab grades will not be recorded unless you use your @mcmaster.ca email address skull
  3. After registering, close all windows, exit the browser, re-open the browser and log in to CodeLab at https://codelab4.turingscraft.com/login
  4. Click on the “Add a Course” button in the courses area
  5. enter the Section Access Code: MCMA-27300-LJBG-42 and click Next> and confirm.
  6. Fill in the Alternate ID field with your MacID (letters+numbers, e.g. smithj1) and click Next>. You must correctly enter your macid at this stage.
  7. After clicking on the terms of service agreement you will be able to navigate to the 1MP3 course content.

Log in

  1. Go to https://codelab4.turingscraft.com/login
  2. the username is the email address given during registration
  3. the password is the password selected during registration

Getting full access

  1. Log in to CodeLab (if you haven’t already)
  2. Click the green Go button next to this course
  3. Click on the upgrade link shown in a beige band at the top of the window; follow the subsequent directions.
  4. Follow the payment directions (options include PayPal/credit card, money order, and payment keys). The cost is US$25.

Online services

notebook

The very simplest way to use Python is to go to http://mcmaster.syzygy.ca, log in with your MacID and password, and open a new “Python 3” notebook.

script + console window

If you want to use a script + console interface (this will be explained in class and tutorial), go to http://mcmaster.syzygy.ca/jupyter/user-redirect/lab, then:

  • File > New > Text File
  • right-click or shift-click on “untitled.txt” in the left-hand file bar: Rename the file to <myfile>.py (where <myfile> is whatever you want to name your script, e.g. week1_stuff.py). (Do not include spaces or punctuation other than _ in your file name.)
  • Go to File > New Console for Editor, open a “Python 3” console
  • Rearrange your windows so that you can see the editor window and console at the same time.

troubleshooting

When accessing the server you might get an error like this:

syzygy error

syzygy error

In general it should be OK to ignore it and try again.

Alternative 1: Python 3.7 + text editor

If you’re running Linux or Mac OSX and are comfortable in the terminal, you can get the basic Python 3.7 stack and use your favourite text editor to work with .py files.

Installation

Note: the installer will also install the latest version of Python 2, which will be the default if you run it from the terminal using python. To avoid this either run python using python3 or make an alias in your .bash_profile from python to the Python 3.7 executable.

More alternatives: other IDEs

Some recommended Python IDEs. These all require you to install Python separately, so you will also have to install Anaconda or vanilla Python 3.

Yet more alternatives

Really you just need some combination of Python stack (Python/Anaconda) and something to edit plain text with. Heck, you can even use vi if you’re into that sort of thing. Do not use a regular WYSIWYG text editor like MS Word: you will be opening yourself up to a world of pain.

Miscellaneous

Python version checking

You can check what version of Python you are using by running this script or by running

python -c "import sys; print(sys.version)"

directly from Terminal.

Package installation

Anaconda should come with all the packages you will need for this course. To install a Python package on Linux/OSX you can use pip3 (for Python 3.7) as follows:

pip3 install "numpy"

for example, to install the numpy package. Replace numpy with whatever package you need.