Virtual environment
A Python virtual environment is an isolated runtime and package-installation context for managing project-specific dependencies separately from other environments and system packages.
Road to Kubernetes
A Python virtual environment is an isolated project environment with its own Python interpreter configuration and installed packages.
- How it is used
- Keeps Python project dependencies organized during local development and deployment while helping avoid version conflicts.
- How deep it goes
- Works through creation, activation, package installation, and deployment automation, while warning that a virtual environment is not true isolation.
- Examples
- Uses a FastAPI project, an /opt/venv server installation, an Ansible playbook, and a Python Dockerfile.
- What you can do after
- Build it from scratch with venv and pip, then operate it through explicit paths or automate it with Ansible and Docker.
Python How-To
A virtual environment is an isolated directory tree containing a Python installation and project dependencies that are separate from the computer's other installations.
- How it is used
- Isolates project dependencies to prevent conflicts between projects requiring different package versions.
- How deep it goes
- Walks through environment creation, activation, dependency installation, editor configuration, and a conda alternative.
- Examples
- Uses a task-management web app with Streamlit and a practice exercise installing pandas.
- What you can do after
- Apply it via venv or conda to create an environment, install dependencies, and select its interpreter in Visual Studio Code.
Coding with AI
A Python virtual environment is an isolated Python runtime environment with its own interpreter and installed packages, separate from other projects and the system installation.
- How it is used
- Uses an isolated runtime as the foundation for organized, project-specific Python development.
- How deep it goes
- Explains isolation, package conflicts, activation, prompt verification, and platform commands without detailing environment internals.
- Examples
- Demonstrates countwords and hrpractice environments through terminal commands, activation prompts, and Linux, macOS, and Windows variants.
- What you can do after
- Operate/configure a project-specific Python runtime and verify its activation before developing or installing project packages.
Django in Action
A Python virtual environment is an isolated environment containing a separate package installation and interpreter context for a project.
- How it is used
- Isolates project package installations to prevent conflicts between Python projects.
- How deep it goes
- Defines isolation and demonstrates creating, activating, and installing Django, while deferring fuller virtual-environment technology details.
- Examples
- Demonstrates a RiffMates directory using `python3.12 -m venv ./venv`, activation, and Django installation.
- What you can do after
- Operate/configure an isolated environment before installing Django and creating a project.
Build Applications with Local AI Models on a Mac
A Python virtual environment is an isolated environment with its own installed packages.
- How it is used
- Keeps project dependencies isolated for clean, reproducible Python application development.
- How deep it goes
- Walks through creation, activation, package installation, recording and rebuilding dependencies, and troubleshooting, with an overview of environment folder contents.
- Examples
- Uses requests and flask in separate projects, a requirements-file rebuild, and a missing Streamlit import to demonstrate the workflow.
- What you can do after
- Operate/configure a virtual environment using venv and pip, share its requirements, rebuild it, and check for interpreter mismatches.
Read how Build Applications with Local AI Models on a Mac explains virtual environment →
Grokking AI Applications
An isolated Python environment containing a project-specific interpreter and installed packages.
- How it is used
- Isolates Langflow installation from other Python projects during local setup.
- How deep it goes
- Recommends creating and activating an environment, but does not explain its internal implementation.
- Examples
- Uses uv commands to create and activate an environment before installing and running Langflow.
- What you can do after
- Operate Langflow locally after installing it inside an isolated Python environment.
Read how Grokking AI Applications explains virtual environment →
The Quick Python Book, Fourth Edition
A virtual environment is an isolated Python installation with its own interpreter and packages, stored in a self-contained directory structure.
- How it is used
- Isolates project interpreters and packages to prevent dependency conflicts across applications and system installations.
- How deep it goes
- Defines the directory structure and gives creation, activation, and package-installation commands, without descending into implementation internals.
- Examples
- Uses `test-env`, platform-specific activation commands, and installing the requests package.
- What you can do after
- Operate/configure isolated Python environments for projects with different interpreter versions and package dependencies.
Read how The Quick Python Book, Fourth Edition explains virtual environment →
Also covered in
- AI Agents and Applications
- Secure APIs
- LLMs in Production
- Hugging Face in Action
- AI Agents in Action
- Build Python Web Apps with Streamlit
- Domain-Specific Small Language Models
- ScyllaDB in Action
- Learn AI-Assisted Python Programming, Second Edition
- Server-Side WebAssembly
- Data Pipelines with Apache Airflow, Second Edition
- The Complete Obsolete Guide to Generative AI
What to know first
- PythonPython is a high-level, general-purpose, dynamically typed programming language with readable syntax and support for multiple programming paradigms.
- functionA function is a callable unit of program code that performs a computation or operation, can accept inputs, and may produce a result or side effect.
- language modelA language model is a computational model that represents patterns in linguistic sequences to assign probabilities, predict, generate, or evaluate language.
- packageA software package is a named unit that groups related software components, either for organization and compilation or for distribution and reuse.
Related concepts
- dependency helladdresses · A software-maintenance condition in which interdependent dependencies create difficult compatibility, versioning, or resolution problems.
- Visual Studio Codeused by · Visual Studio Code is a free, cross-platform source-code editor developed by Microsoft, with an extensible ecosystem of programming-language and development tools.
Questions about virtual environment
What is virtual environment?
A Python virtual environment is an isolated runtime and package-installation context for managing project-specific dependencies separately from other environments and system packages.
Which Manning books explain virtual environment?
Road to Kubernetes, Python How-To, Coding with AI, Django in Action, Build Applications with Local AI Models on a Mac, Grokking AI Applications and The Quick Python Book, Fourth Edition.
What should I know before learning virtual environment?
Manning books that teach virtual environment usually introduce Python, function, language model and package first.
What is virtual environment also called?
Virtual environment is also called venv or virtualenv.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.






