Part 0. Checking for Python Install
To get your workspace working without using the Docker Dev Container, you first want to see if python is installed on your computer.
Open your terminal and type
python --version
. If you see something likePython 3.11.1
(or greater), congratulations! You already have Python installed. You can skip the rest of these steps and continue to Part 2.If you get an error, try typing
python3 --version
.
If you get an error message, skip the rest of this step and continue to Part 1.
If you see something like Python 3.11.1
(or greater), then you have the correct version installed and just need to update your terminal command so that the python
command works! Type the following command in your terminal exactly:
sudo ln -s "$(which python3)" "$(dirname $(which python3))/python"
It may prompt you for your computer password. This change will only take place in a new shell session. Type the exit command, press enter, close your terminal. Retry the command python --version
to check it is successfully linked to Python 3.11.1 or greater. You can now skip Part 1 and continue to Part 2!
Part 1. Installing Python
Windows 10 and 11 Instructions
For these steps, be sure your web browser Window is maximized and be sure to follow step 4.0 closely that checks the option “Add Python 3.11.1 to Path” during install.
- Open the Python Website in another tab: https://www.python.org
- Press the Downloads button in navigation.
- In the headline, you should see “Download the latest version for Windows”.
- If, instead, you see “Download the latest version of Python” be sure your browser Window is maximized and refresh the web page.
- Press the Download Python 3.11.4 button. The download should begin.
- If you are taken to another page without a download beginning, scroll down to the Files heading and select the file named
Windows x86 executable installer
.**
- If you are taken to another page without a download beginning, scroll down to the Files heading and select the file named
- Open the download once it completes and carefully follow the instructions below, especially the first one:
- IMPORTANT: Check the box on the first screen labelled “Add Python 3.11.4 to PATH”
- If you do not see this option, you likely have an older version of Python already installed. Go ahead and uninstall the old version and then retry installing the new version.
- Knowing exactly what this does is beyond your concern, but the gist is it makes it easier for other programs on your system to make use of Python.
- After checking the box of Step 0, click Install Now.
- Allow the installer to make changes if further prompted.
- Accept other defaults on following screens.
- Click the Close button to complete the Install.
- IMPORTANT: Check the box on the first screen labelled “Add Python 3.11.4 to PATH”
macOS Instructions
Before beginning, be sure you are using the latest version of macOS.
0. Update Your Default Shell in the Terminal
There are two pieces of jargon in the title of this section. A “shell” is a program that serves as a concierge to your computer: you give it commands, such as asking it to run a program you’re working on, and the shell does the work of carrying out your command. A “terminal” is the program you will use to interact with your shell. Apple recently updated its recommended shell software to Z-shell, or zsh
, so let’s be sure yours is configured to use it.
- Using Mac’s Spotlight Search, accessed by pressing
Command + Spacebar
or clicking the search icon near your clock, typeTerminal
and press enter. This starts the Terminal app, which may look like what hackers use in the movies, because it is. - Let’s learn what shell program your terminal is using by default by typing the following (cryptic, based on what we know now) command and pressing enter:
echo $SHELL
(yes, that’s the wordecho
, followed by a space, and then a dollar sign followed immediately by the word SHELL in all capital letters,$SHELL
) - If you see
/bin/bash
in the text “printed” below your command, continue to next step to update your default. If, instead, you see/bin/zsh
, you are all set and can jump to step 6. - Since you saw
bash
instead ofzsh
, let’sch
ange your defaultsh
ell using thechsh
program to be the location, or path, of thezsh
shell program on your computer which is/bin/zsh
. Type the following command, check that yours matches exactly, in both spaces and capitalization, and press enter:chsh -s /bin/zsh
- You will likely be asked for your computer’s password. When you type in your password you will not see any text appear on your screen, not even dots, but the keys you type are being received. Press enter once you’ve entered your password. If you see “Credentials could not be verified, username or password is invalid.” try running the command again and entering your laptop’s password again.
- This change will be applied to your next shell session, so type
exit
, close yourTerminal
again. Go back up to step 0, and continue from there, to confirm it was successful. - Great! You can quit your shell session by typing
exit
, pressing enter, and then closing yourTerminal
window.
1. Install (or Update) the Python Programming Language Toolkit (3.11.1 or greater)
For these steps, be sure your Web Browser window is maximized.
- Open the Python Website in a new tab: https://www.python.org
- Select the Downloads button in the navigation
- Look for the “Download latest version for Mac OS X”
- If you instead see, “Download the latest version of Python”, make sure your browser is full screen and refresh the page.
- Click the Download Python 3.11.4 button. Your download should begin.
- If you are brought to another page, scroll down to the Files section and select the
macOS 64-bit universal2 installer
.
- If you are brought to another page, scroll down to the Files section and select the
- Open the downloaded package to begin the installer
- At Introduction screen: Continue
- At the Read Me screen: Continue
- At the License: Continue (Agree)
- At Installation Type: Install
- After Install completes, select Close and close any windows it popped up.
- If asked, move the installer to Trash
2. Configure your Shell to use the Latest Python
- Open a new Terminal window. If you still have one open from section 0, close it out and start a new one, because changes made during the installation of Python will not take effect until a new shell session begins.
- Give the command
python3 --version
, notice the3
after the wordpython
and two dashes at the front of--version
, and press enter. You should seePython 3.11.1
(or greater) which indicates your install was successful. If not, try the steps above one more time and restart your computer before trying these. Otherwise, come work with us in office hours! - Now try giving the command
python --version
, without the3
from above. If you seePython 2.X.YY
, whereX
andYY
are irrelevant numbers, continue to the next step because Mac also includes a much older version of Python. This is confusing when you’re trying to learn modern Python! If you seePython 3.X.YY
, but notPython 3.11.1
or greater, this means you previously installed an older version of Python3, and you should also continue to step 3. If you see the resultPython 3.11.x
then you are all set and can continue to the next section on installing VSCode. - Let’s simplify life by making
python
refer to the latest version you just installed, not the old one. What the following command is doing is making a link between the namepython
and the version you just installed. The command is more advanced than where we are at, so do not worry yourself on its details. You should copy and paste the following command into your Terminal, and press enter, because the punctuation symbols need to match precisely.
sudo ln -s "$(which python3)" "$(dirname $(which python3))/python"
If you are prompted for a password, enter your computer’s password. You will not see any indication of your keystrokes show up as you type in your password, but they are being recorded. Press enter after typing your password invisibly. 4. 4. This change will only take place in a new shell session. Type the exit
command, press enter, close your terminal. Go back to Step 0 and continue on until confirming python --version
is successfully linked to Python 3.11.1
or greater.
Part 2. Install requirements.
First, you’re going to want to pull the latest version of the course workspace from github.
“Pulling” course materials down from Upstream.
MAKE SURE YOU PUSH YOUR LOCAL CHANGES BEFORE DOING THIS!!!s
Open the View menu and select Command Palette
- The shortcut for this menu is:
- Windows: Control+Shift+P
- Mac: Command+Shift+P
Begin typing in Git: Pull From… and press Enter once it is the first option.
Begin typing in
origin
and press Enter once it is the first option.Press enter with
origin/main
as the first option.This downloads the latest course materials! It will succeed silently, so if nothing appears to happen, check to confirm that the “requirements.txt” file showed up in your workspace files. If there was an error, you would see an error message pop up.
Common errors/solutions:
- Make sure you PUSHED all of your changes to backup first!!!
- In your terminal, type git config pull.rebase false
- In your Visual Studio command center, select Pull From… -> Upstream -> Upstream/Head. (If not an option, do Origin -> Main.)
If you’re still having issues, come to office hours!
Install requirements
You can install the workspace requirements using the following command in your terminal:
python -m pip install -r requirements.txt
Congratulations! You should be good to go!