`bash: .venv/bin/activate: No such file or directory` in a CI job, although the venv was created in an earlier step.
IntermediateTroubleshootingEnvironments, imports & packaging errors
Answer
Likely causes → The working directory changed, the venv was created in a different job (jobs do not share filesystems), or python3-venv is missing so creation failed silently earlier (ensurepip is not available).
Diagnose →
pwd; ls -la .venv/bin 2>&1
python3 -m venv .venv; echo $?
Fix → Create the venv in the same job, use absolute paths, install python3-venv on Debian/Ubuntu runners, or use actions/setup-python and skip the venv.
Prevent → Each CI job is a fresh machine; share artifacts or caches explicitly.
More on Environments, imports & packaging errors
`ModuleNotFoundError: No module named 'boto3'` right after you ran `pip install boto3`.Beginner`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