Back to Modern Python Foundations

Virtual Envs & Dependency Management

Isolate per-project dependencies. The 2026 tooling: uv (recommended), poetry, pip-tools, venv. How they differ. FIND_VIDEO: search 'python virtual environment uv poetry pip-tools' — recommended channel: ArjanCodes / Real Python. Aim for 9 min or under.

9 minutesVideo LessonPDF notes
🎯 Free Guest Mode: You are learning for free. Sign in to save your completion progress and quiz answers.

Ready to continue?

Mark this lesson as complete when you're ready to proceed.

Key moments

  1. Virtual Environments Overview — Explains why project dependency isolation prevents cross-project package version conflicts.
  2. Creating Environments — Demonstrates creating virtual environment directories using the built-in venv module across platforms.
  3. Activation and Deactivation — Shows how to activate and deactivate virtual environments on Windows, macOS, and Linux.
  4. Package Management — Illustrates inspecting clean environment libraries and installing external packages like requests with pip.
  5. Exporting and Replicating Dependencies — Covers exporting package snapshots with pip freeze and reinstalling them via requirements.txt.
  6. Project Structure and Cleanup — Outlines directory organization best practices, code separation, and environment deletion.
PDF notes

Frequently asked questions

Why does pip list show global packages instead of isolated project packages?

The virtual environment is not currently active. Run the activation script for your operating system and verify the terminal prompt shows the environment prefix.

Can I rename or move a virtual environment directory to another folder?

Virtual environment scripts contain hardcoded file paths. Delete the existing directory, re-create it in the new location, and reinstall dependencies using your requirements.txt.

What tools other than venv exist for Python environment management?

Third-party alternatives mentioned in the lesson include Conda, virtualenv, Pipenv, and Poetry, though venv is built directly into Python.

How do I completely remove a virtual environment when finished?

Deactivate the environment if active, then delete the virtual environment folder using your terminal or system file manager.

How was this lesson?

Your feedback helps us refine explanations and catch bugs.