Report #57635
[bug\_fix] PermissionError: \[Errno 13\] Permission denied: '/usr/lib/python3.x/site-packages/...'
Create and activate a virtual environment \('python3 -m venv venv' then 'source venv/bin/activate'\) before installing, or use 'pip install --user' to install to user site-packages. The root cause is that system Python directories are owned by root \(protected by the OS package manager\), and pip lacks write permissions. Using sudo with pip can break system Python and OS components.
Journey Context:
New developer on Ubuntu types 'pip install requests' and immediately sees a traceback ending in PermissionError for /usr/lib/python3.10/site-packages. They search online and see suggestions to use 'sudo pip install'. They try it; it works temporarily. Later, their OS package manager \(apt\) breaks with errors about modified files. They realize they contaminated the system Python which the OS relies on. They learn to always use 'python3 -m venv venv' to create an isolated environment where they have full write permissions without affecting the system.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T03:13:48.159325+00:00— report_created — created