`ModuleNotFoundError: No module named 'boto3'` right after you ran `pip install boto3`.
BeginnerTroubleshootingEnvironments, imports & packaging errors
Answer
Likely causes → pip belongs to a different interpreter than python (system vs venv, python3.11 vs python3.12), or the venv is not activated in this shell, or cron/systemd uses the system Python.
Diagnose →
which python pip; python -c "import sys; print(sys.executable)"
pip --version # shows which Python it installs into
python -m pip show boto3
Fix → Install with the interpreter you run: python -m pip install boto3. In cron/systemd, call /opt/tool/.venv/bin/python explicitly.
Prevent → Always use python -m pip; use console-script entry points or absolute venv paths in schedulers.
More on Environments, imports & packaging errors
`error: externally-managed-environment` when running `pip install requests` on Ubuntu 24.04.Beginner`ImportError: attempted relative import with no known parent package` when running `python cloudaudit/cli.py`.Intermediate`AttributeError: partially initialized module 'yaml' has no attribute 'safe_load' (most likely due to a circular import)`Beginner`ERROR: Could not find a version that satisfies the requirement boto3==1.40.99 (from versions: ...)`Beginner`ERROR: ResolutionImpossible: ... The conflict is caused by: botocore 1.35.x depends on urllib3<1.27 ... requests 2.x depends on urllib3>=2`Advanced`pip install` on `python:3.12-alpine` takes 15 minutes and ends with `error: command 'gcc' failed: No such file or directory`.Intermediate