Command Not Found in AI Environments: Linux, Containers and CI
command not found means the shell could not resolve an executable by that name. In AI development this often appears after installing a model CLI, Python package, CUDA tool or deployment utility in one environment and running it from another.
Identify the shell and search path
printf '%s\n' "$SHELL"
printf '%s\n' "$PATH" | tr ':' '\n'
command -v TOOL_NAME
type -a TOOL_NAME
The shell searches PATH in order. Avoid adding broad writable directories or . merely to make a command resolve; that can execute an unintended binary.
Confirm where the tool was installed
python -m pip show PACKAGE_NAME
python -m site --user-base
npm prefix -g
which python
python --version
Common mismatches include:
- package installed with one Python interpreter and executed with another;
- virtual environment not activated;
- user-level binary directory missing from
PATH; - global npm binary directory unavailable in a non-interactive shell;
- CLI installed on the host but command run inside a container;
- CI image differs from the developer workstation;
- GPU or cloud tools absent from a minimal runtime image.
For Python AI dependencies, use pip installation troubleshooting rather than mixing system and project interpreters.
Virtual environments and local AI
python -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt
command -v python
command -v TOOL_NAME
Prefer python -m pip so the installer and runtime refer to the same interpreter. Record dependencies and avoid relying on an activated shell in production services.
Containers and CI
Inspect the environment where the failure occurs:
docker run --rm IMAGE sh -lc 'echo "$PATH"; command -v TOOL_NAME'
Install build tools in build stages and copy only required runtime artifacts. If a CLI is needed at runtime, verify it exists in the final imageβnot only the builder.
In CI, use explicit setup steps and pinned tool versions. Interactive shell profiles may not load, so a command added in .zshrc can work locally and fail in automation. Link repository gates to GitHub Actions for AI applications.
Do not βfixβ it unsafely
Avoid:
- downloading and executing an unverified installer as root;
- copying arbitrary binaries into
/usr/local/bin; - using
sudoto escape a broken project environment; - disabling signature or checksum verification;
- changing system Python for one model tool.
Verify the publisher, artifact and version before installation. The AI Security hub covers credential and supply-chain boundaries.
Make the environment reproducible
Pin language and CLI versions, declare them in container or CI configuration, test the final runtime image and expose a startup check for required binaries. Connect environment ownership to the AI Operations hub and Linux foundation for AI developers.
The durable fix is not finding any executable with the right name. It is ensuring the approved executable exists in the intended environment and resolves consistently across local development, CI and production.