Handle missing accelerate executable in env command - #4168
Open
tandede wants to merge 1 commit into
Open
Conversation
tandede
force-pushed
the
fix-env-missing-cli-path
branch
from
August 19, 2026 13:53
5696554 to
f272275
Compare
tandede
marked this pull request as ready for review
August 19, 2026 13:53
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
which/wheresubprocess withshutil.whichNot founddiagnostic when the console script is not onPATHaccelerateexecutable onPATHWhy
accelerate envinitializes the reported executable location toNot 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 andsubprocess.check_output()raisesCalledProcessError. 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 stylemake quality