This semester, we are standardizing on the following variant of Python: Anaconda's Python 3.7.x, where "x" can be any number. This version is already installed on the ACCEL/Phillips computers, so you can do all your work on lab computers, if you like. (But you can't store files on them, so make sure you upload or download your files somewhere to retain access.)
Or, you may have your own computer and wish to install this semester's version of Python on it. Installing Python can be more complicated than using it. We have tried to make installation as simple as possible via step-by-step instructions. It's okay if you don't understand all the steps. Also, these instructions are lengthy because we are trying to support multiple operating systems. In practice, you should be able to finish the installation in 15-20 minutes.
If you have problems, and if you have a laptop, the best thing to do is to bring it in to someone to look at. Any of the course staff can help you with this. If you cannot bring in your computer, we have provided you with some diagnostic instructions below. If you are having difficulty with these instructions, feel free to post your questions on Piazza or email Kevin Cook, a Head Consultant who contributed to these instructions.
While installing the base Python package is usually straight-forward, getting add-ons for Python can be a bit tricky. That is why we have decided to standardize on the Anaconda version of Python, which is free, quickly becoming standard on this campus, and contains a lot of add-ons, limiting the number of things you need to install later.
Before you you begin the installation, be sure to completely read the instructions for your operating system. While you are unlikely to make any mistakes, it is best for you to do things in exactly the order we tell you to. As we said, you do not need to understand what is going on here.
We requite that all students with Windows use Windows 10. If your computer cannot support Windows 10, you can work on the lab computers instead. (But you can't store files on them, so make sure you upload or download your files somewhere to retain access.)
Even if you have Anaconda installed already, it is safest if you install from the links below to guarantee that you have the correct version for this class.
Installing Anaconda for Python3.6 |
Windows 32-bit Anaconda 3.7 |
Windows 64-bit Anaconda 3.7 |
Use one of the two links above to install the correct version for your operating system. Most modern Window installations are 64-bit. However, if you are unsure, download the 32-bit version. The 32-bit version is guaranteed to work on all systems.
The file that you download is an installer app. Simply double-click on it and follow directions. At some point, you will be asked whether you want to install for yourself or for all users. Select the option "All Users (requires admin privileges)", as shown below.
On the next page it will ask you what directory you want to install in. By default,
it will install in C:\ProgramData\Anaconda3
. Leave this alone and click Next.
Finally, you will see a page with checkboxes talking about your Path. You must select the top box, even though you get a warning not to. If you do not check this box, you will not be able to use Python from the PowerShell.
Once you have finished, you should test your installation.
The version of Python that we are using for this class is only compatible with Sierra (10.12) or higher. If you have an older version of MacOS, we recommend that you upgrade to Catalina (10.15) immediately. Alternately, you can work on the lab computers. (But you can't store files on them, so make sure you upload or download your files somewhere to retain access.)
We have standardized on Python version 3.7.
Even if you have Anaconda installed already, it is safest if you install from the links below to guarantee that you have the correct version for this class.
Installing Anaconda for Python 3.7 |
Mac OS X 64-bit Anaconda 3.7 |
Use the above to install the correct version for your operating system. The file that you download is an installer app. Simply double-click on it and follow directions. You may wish to change the install location on this page:
Note that you may see the following error message:
This problem is easy to solve. If you just click on the house, it will now look like this.
It is okay for you to install Anaconda this way. However, we would prefer that you install it for all users instead. Select the hard drive icon below the house. When you are done, it should look like this.
Select the button Choose Folder to the right. This will tell it where to put Anaconda. We recommend that you put it in the Applications folder.
When you download this file, you may be taken to a web page asking you to fill in some information. Ignore this web page. You do not need to fill in the information; your download has started already.
Once this is done, you are now are ready to test your installation.Linux installation is possible, but it is not as straightforward as the two main OS options. In particular, to install on Linux, you have to be comfortable with the appropriate command shell and be ready to install files with a package installer. If this sounds daunting to you, you might want to rethink whether you want to use Linux just yet.
For this class, we require Python version 3.7.
Installing Anaconda for Python 3.7 |
Linux 64-bit Anaconda 3.7 |
Use the link above to install Anaconda. This is not a graphical installer. To install it, you must navigate to the folder with the downloaded file and run it with bash. For example, after navigating to the correct folder, you would type:
bash Anaconda3-2019.10-Linux-x86_64.sh
You must use the “bash” command even if you are not using the bash shell.
Now that you have installed Anaconda (or are sitting down at an ACCEL or Phillips 318 lab computer for the first time), it is a good idea to test the installation out, using the command shell for your OS. The command shell is a text-based version of the Windows Explorer or Finder; you can use it to move and rename files and folders. It is also how we will run Python in this class.
Using the command shell requires a bit of practice, so we have created a separate page of instructions for this. Right now, all you need to know is how to start up the command shell; you do not need to know any special commands.
Open a command shell window. Then, type
python
(and hit return). This should put you in the “Python Interactive Shell”; you can tell this succeeded because a Python "banner" message will be printed out, and you'll get the Python ">>>" (three greater-than signs) prompt. If this happens, you're done with Test #1; go to Test #2.
If instead you get some sort of error message suggesting that Python could not be found, or if you are on Windows and the Microsoft Store opens asking if you would like to get Python, first reboot and try Test #1 again.
If you still get this kind of error message after rebooting, let's try to see if Anaconda Python 3 is somewhere on your computer (even though the command shell isn't "seeing" it).
ls {/opt,/Applications,~,/Users/Shared/Relocated Items/Security}/anaconda3/bin/python 2>/dev/null; echo "..."You should get output that ends with the line "...".
ls C:\ProgramData\Anaconda3\python.exe ; echo "..."
Otherwise, you got at least one line of output besides the "...", and with luck, one of those lines says something about "Anaconda" or "anaconda". That line could look like one of the following, and the "directory" we want is the part just before the last slash and the word "python":
output from the "ls" command | the Anaconda directory |
/opt/anaconda3/bin/python | /opt/anaconda3/bin |
/Applications/anaconda3/bin/python | /Applications/anaconda3/bin |
C:\ProgramData\Anaconda3\python.exe | C:\ProgramData\Anaconda3 |
echo $SHELLyou get back the answer "
/bin/zsh
", then the easiest thing to do is to "change your shell from zsh to bash". Follow the directions here: How to change the default shell to bash on macOS Catalina.echo $SHELL
should give you something like /bin/bash
)
The underlined text below shows what we're looking for. This may vary slightly based on your machine, but you should definitely see the parts that say "Python 3.7" and "Anaconda".
If not, your system is running the wrong Python for this class.
First, try rebooting, and run Test #1 again.
If you still get the "wrong" Python after rebooting, follow the instructions in both Find where the Anaconda directory is and Adding the necessary directory to your path.
.The > > > symbols are the prompt. To get the shell to do something, just type a Python command. For example, type
>>> 1+1
and hit Return (do not type the > > >; it is already there).
If anything other than the appearance of the numeral "2" happens, record the precise output, even if it's a very long error message (copy-and-paste is best) to report the problem to us.
Otherwise, you have a working installation of Anaconda Python 3.7.
To exit the Python Interactive Shell, type quit()
or
exit()
and hit Return.