Skip to content
Latchkey

Hugging Face "huggingface-cli: command not found" in CI

The huggingface-cli launcher ships with the huggingface_hub package. If that package is not installed into the interpreter CI uses, or its scripts directory is not on PATH, the shell cannot find the command.

What this error means

A step running huggingface-cli login or huggingface-cli download fails with "huggingface-cli: command not found" and exit code 127.

huggingface_hub
/home/runner/work/_temp/script.sh: line 1: huggingface-cli: command not found
Error: Process completed with exit code 127.

Common causes

huggingface_hub is not installed

No install step provided the package, so the console script does not exist on the runner.

Installed under a different interpreter or venv

The CLI landed in a venv or user scripts dir that the current step did not put on PATH.

How to fix it

Install huggingface_hub, then use the module form

Install the package into the active interpreter and invoke through Python so PATH is never an issue.

Terminal
python -m pip install -U "huggingface_hub[cli]"
python -m huggingface_hub download bert-base-uncased config.json

Do library operations in Python

Skip the CLI entirely and call the API, which only needs the package installed.

python
from huggingface_hub import hf_hub_download
hf_hub_download("bert-base-uncased", "config.json")

How to prevent it

  • Install huggingface_hub[cli] explicitly in the job.
  • Call python -m huggingface_hub to avoid PATH problems.
  • Activate the venv that holds the CLI in every step that uses it.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →