Interview Prep/Python for DevOps/Environments, imports & packaging errors

`ImportError: libssl.so.1.1: cannot open shared object file` after copying a venv from one machine to another.

AdvancedTroubleshootingEnvironments, imports & packaging errors
Answer

Likely causes → Venvs are not portable: they hardcode the interpreter path and compiled extensions link against system libraries that differ between hosts (OpenSSL 1.1 vs 3).

Diagnose →

head -1 .venv/bin/pip            # absolute path to original interpreter
ldd .venv/lib/python3*/site-packages/**/*.so 2>/dev/null | grep "not found"

Fix → Recreate the venv on the target from the lock file. To ship prebuilt, use a container image or build wheels on the target platform.

Prevent → Ship code plus lock, or containers; never copy venvs across machines or OS versions.

All Python for DevOps questions Roadmap: Python for automation

More on Environments, imports & packaging errors