π ~1 min read
Table of contents
Symptom & Impact
python3 -m venv fails, blocking isolated dependency setup for projects.
Environment & Reproduction
Minimal Ubuntu installs may not include venv module by default.
python3 --version
python3 -m venv .venv
Root Cause Analysis
python3-venv package is missing or tied to a different Python minor version.
Quick Triage
Check installed Python packages and module availability.
dpkg -l | grep python3-venv
python3 -m ensurepip --version 2>/dev/null || true
Step-by-Step Diagnosis
Identify active Python interpreter and matching venv package.
which python3
python3 -c 'import sys; print(sys.version)'
apt-cache policy python3-venv

Solution – Primary Fix
Install python3-venv and recreate the virtual environment.
Still having issues? Our IT Solutions & Services team can diagnose and resolve this for you. Get in touch for a free consultation.
sudo apt update
sudo apt install python3-venv -y
python3 -m venv .venv
source .venv/bin/activate

Solution – Alternative Approaches
Use virtualenv from pipx if project standards require custom tooling.
sudo apt install pipx -y
pipx install virtualenv
virtualenv .venv
Verification & Acceptance Criteria
Virtual environment activates and isolated pip installs work.
source .venv/bin/activate
python -m pip --version
Rollback Plan
Remove malformed virtual environment and rebuild cleanly.
rm -rf .venv
python3 -m venv .venv
Prevention & Hardening
Add python3-venv to base image packages for development hosts.
sudo apt-mark manual python3-venv
Related Errors & Cross-Refs
Related errors include ensurepip is not available and No module named venv.
Related tutorial: View the step-by-step tutorial for Ubuntu 24.04 LTS.
View all Ubuntu 24.04 LTS tutorials on the Tutorials Hub β
Browse all common problems & solutions on the Tutorials Hub.
References & Further Reading
Python venv documentation and Ubuntu Python package guide.
Need Expert Help?
If you cannot resolve this yourself, our team offers hands-on Server Management, Managed IT Services, and flexible Support Plans. Contact us today β we respond within one business day.