Dev Setup

Python and venv first steps after installing VS Code

Install Python, create a virtual environment, select the interpreter in VS Code, and avoid the “wrong Python” trap when using the Dev Setup Python preset.

The Dev Setup Python / data preset installs editor support (Python extension with Pylance, Jupyter, Ruff, and related helpers). It does not install the Python runtime or create a virtual environment for you. If the status bar shows “Select Interpreter,” import fails, or pip installs packages into the wrong place, follow this guide before blaming the extensions.

Install a supported Python

Download a current stable Python 3 release from python.org on Windows and macOS, or use your package manager on Linux. On Windows, enable “Add python.exe to PATH” during setup. Afterward, open a new terminal and run python --version (or python3 --version on macOS/Linux). If the command is missing, fix PATH the same way you would for Node: new terminal after install, verify the installer path.

Why virtual environments matter

A venv isolates project dependencies so Course A’s packages do not break Course B. Professional tutorials and most employment setups expect a venv (or equivalent) per project. Installing everything globally works until two projects need different versions of the same library—then debugging gets painful.

Create and activate a venv

  1. Open the project folder in VS Code.
  2. In the integrated terminal, create an environment: python -m venv .venv (use python3 if that is your command).
  3. Activate on Windows PowerShell: .\.venv\Scripts\Activate.ps1
  4. Activate on macOS/Linux: source .venv/bin/activate
  5. Your prompt usually shows (.venv). Then run python -m pip install --upgrade pip and install packages from requirements.txt if the project provides one.

If PowerShell blocks Activate.ps1, you can run the activation script from cmd.exe, change execution policy for the current user after reading Microsoft’s docs, or call .venv\Scripts\python.exe -m pip install … without activating.

Select the interpreter in VS Code

Open the Command Palette → “Python: Select Interpreter” → choose the interpreter inside .venv. The status bar should point at that environment. Jupyter kernels and Ruff will follow the selected interpreter when configured correctly. If imports still fail, confirm the terminal that runs scripts is the activated venv and that you did not install packages with a different python.exe.

Ruff and course toolchains

Dev Setup may suggest Ruff for linting and formatting. If your class requires Black, flake8, or pylint only, uncheck Ruff on the extensions step or disable it later. The Python extension remains useful either way. Documentation feedback: https://github.com/smartopslab128-ctrl/gif-image-paste/issues