There is one missing step in the setup when using uv with VS Code, especially for Interactive Python (Jupyter).
After creating a project with uv, the project uses a local virtual environment (.venv) based on the system’s Python (e.g., via pyenv). However, VS Code often defaults to the global Python interpreter instead of the project’s .venv.
This causes a mismatch:
- Running scripts via
uv run works correctly (uses .venv)
- Interactive Python / Jupyter fails with
ModuleNotFoundError because it uses the global interpreter without installed packages
Missing step:
Users need to explicitly select the project interpreter in VS Code:
→ Python: Select Interpreter
→ Choose: .venv/bin/python (project environment)
This ensures both script execution and interactive mode use the same environment.
Without this step, beginners may encounter confusing import errors despite correct setup.
There is one missing step in the setup when using
uvwith VS Code, especially for Interactive Python (Jupyter).After creating a project with
uv, the project uses a local virtual environment (.venv) based on the system’s Python (e.g., viapyenv). However, VS Code often defaults to the global Python interpreter instead of the project’s.venv.This causes a mismatch:
uv runworks correctly (uses.venv)ModuleNotFoundErrorbecause it uses the global interpreter without installed packagesMissing step:
Users need to explicitly select the project interpreter in VS Code:
→
Python: Select Interpreter→ Choose:
.venv/bin/python(project environment)This ensures both script execution and interactive mode use the same environment.
Without this step, beginners may encounter confusing import errors despite correct setup.