Computational Physics at U of T uses Python 3 from the Anaconda distribution. The documentation on this website will cover Spyder and Jupyter notebooks. Older versions of the website covered Python 2 using VIDLE. As a result of the update, we no longer support or use the VPython package.
If you're interested in background on the Python 3 migration and the other changes, read this background information.
"I need help!!": If you are a University of Toronto Physics student and need help, feel free to email questions to firstname.lastname@example.org. In your support requests, please include
- Your name.
- Your student number.
- The course (or research project) you're in.
- A detailed description of your problem, including the computer you are using, the OS version, and the issue itself.
We will not be able to help you unless you provide this information. We cannot provide help to folks outside U of T Physics.
2. Installing Anaconda Python 3
So, let's get started on installing Python 3 on your computer!
To install this software:
- Read the instructions on installing to the end.
- Then try to download, install, and set up Python 3 on your computer.
- Finally, test out your distribution and get familiar with software by working through "3. Getting started with Anaconda Python 3/Spyder".
Here are the instructions on installing:
- Go tohttps://anaconda.com and follow the "Download Anaconda" link, which takes you to https://www.anaconda.com/download/.
- Click on the tab for your platform of choice for your computer (Windows/Mac/Linux).
- You will typically choose 64-bit for newer computers.
- If you are a current U of T Physics student who is unsure how to follow the provided instructions, please feel free to contact email@example.com for assistance.
- If you have an older computer or OS version, and find that the distribution you download in this way does not work, you can go to the archive of previous distributions, linked from the anaconda downloads page, and find a distribution that more closely matches your computer platform.
- Install the software following the prompts.
- We recommend default installation. This is installation for you as a sole user, not system wide.
- If you have installed a previous version of anaconda (e.g. a Python 2 distribution) and wish to maintain multiple versions, we will assume that you know how to deal with this but can't offer support for this at this time.
- Otherwise, we recommend you uninstall the previous version of anaconda.
3. Getting started with Anaconda Python 3/Spyder and running scripts
By this point, you should have installed Anaconda Python 3.
Below are a few steps to test your distribution and get familiar with how to run your new Python 3 software. You can use the Spyder program to edit and run Python scripts. Spyder is sometimes called an Integrated Development Environment, or IDE.
Note: to avoid unexpected behaviour, open .py files from your Python IDE instead of clicking on them. It is usually better for you to open Python scripts (.py files) from inside your IDE session than by clicking on the file itself. This is because your computer may be set up to run another version of Python when you open a .py file, or because your computer may not know what to do with .py files at all.
To find and execute the command to start Spyder, separate instructions for Windows (Section 3a) and Mac OS (Section 3b) are provided below.
3a. Windows startup instructions
- On Windows, a link to Spyder can be found in Start Menu → Programs → Anaconda3 (64-bit).
- The simplest way to find it is to search for Spyder and click on the icon for the Spyder application.
- You can then install a shortcut to your favourite location.
- When you start Spyder for the first time, it will sometimes take a long time (a couple of minutes) for the initial splash screen to appear.
- If it doesn't appear after a few minutes, try starting it again, and if it still doesn't appear and you are a current U of T Physics student, contact firstname.lastname@example.org for help.
- Once you've started Spyder the first time, you might need to click past a couple of dialogue boxes.
- Once you've started Spyder, you should see a screen that looks like the following:
- We'll go into the details of the different parts of the Spyder in our tutorials.
3b. Mac OS X startup instructions
- On Mac OS, Spyder can be found using the Anaconda Navigator or at anaconda → bin → spyder in your home folder.
- You can also search for Spyder in Spotlight
- Opening Spyder will first open a terminal session and then open a graphical Spyder window.
- You might see a message suggesting that there is an "Update Available". You can ignore this.
- Also, a terminal session will be started with a bunch of messages of the form:
[warn] kq_init: detected broken kqueue; not using.: Undefined error: 0
- These can be safely ignored
- The result will look something like what is shown below.
- We'll go into the details of the different parts of the Spyder window in our tutorials.
4. Testing your software
We will explore more how to use the Spyder Integrated Development Environment (IDE) in our tutorials. For now, to test if your distribution is working, do the following:
- Download the script histogram_demo_features.py , which is taken from the matplotlib gallery.
- Open it from inside Spyder and run it by pressing the play button or F5.
- The result should be a window inside the Spyder session that looks like the following:
- Download and run the error bar script.
- See if you obtain the following inside the Spyder session:
- You should have now installed Anaconda Python on your computer.
- You should have also found the Spyder IDE and started a session with it.
- You had a chance to download and test a couple of Python plotting scripts inside Spyder.
- If you were interested, you learned some background on the software used at compwiki.physics.utoronto.ca.
Well done! Now you are ready to work through our four part tutorial, starting with Part 1.
The computation.physics.utoronto.ca site content is Copyright Department of Physics, University of Toronto.