Skip to content

Handle missing accelerate executable in env command - #4168

Open
tandede wants to merge 1 commit into
huggingface:mainfrom
tandede:fix-env-missing-cli-path
Open

Handle missing accelerate executable in env command#4168
tandede wants to merge 1 commit into
huggingface:mainfrom
tandede:fix-env-missing-cli-path

Conversation

@tandede

@tandede tandede commented Aug 18, 2026

Copy link
Copy Markdown

Summary

  • replace the platform-specific which/where subprocess with shutil.which
  • preserve the existing Not found diagnostic when the console script is not on PATH
  • add regression coverage for invoking the environment command without an accelerate executable on PATH

Why

accelerate env initializes the reported executable location to Not found, but then unconditionally runs an external lookup command. When Accelerate is invoked through an explicit path without activating its environment, that lookup exits non-zero and subprocess.check_output() raises CalledProcessError. As a result, the diagnostic command crashes instead of reporting the already-intended fallback.

Using shutil.which() provides the same lookup on POSIX and Windows while allowing a missing executable to be handled normally.

Validation

  • PATH=/usr/bin:/bin accelerate env (reports `accelerate` bash location: Not found)
  • pytest -q tests/test_cli.py -k 'EnvCommandTester or test_hyphen or test_underscore' (3 passed)
  • pytest -q tests/test_memory_utils.py (7 passed)
  • pytest -q tests/test_cli.py -k 'not test_invalid_model_name_transformers' (38 passed, 1 skipped, 5 subtests passed)
  • make style
  • make quality

@tandede
tandede force-pushed the fix-env-missing-cli-path branch from 5696554 to f272275 Compare August 19, 2026 13:53
@tandede
tandede marked this pull request as ready for review August 19, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant