diff --git a/spacy/errors.py b/spacy/errors.py index 1af673569..66a3c61da 100644 --- a/spacy/errors.py +++ b/spacy/errors.py @@ -539,6 +539,7 @@ class Errors(object): E199 = ("Unable to merge 0-length span at doc[{start}:{end}].") # TODO: fix numbering after merging develop into master + E970 = ("Can not execute command '{str_command}'. Do you have '{tool}' installed?") E971 = ("Found incompatible lengths in Doc.from_array: {array_length} for the " "array and {doc_length} for the Doc itself.") E972 = ("Example.__init__ got None for '{arg}'. Requires Doc.") diff --git a/spacy/util.py b/spacy/util.py index 1d998ec36..7c29bed8e 100644 --- a/spacy/util.py +++ b/spacy/util.py @@ -452,7 +452,12 @@ def run_command(command: Union[str, List[str]]) -> None: """ if isinstance(command, str): command = split_command(command) - status = subprocess.call(command, env=os.environ.copy()) + try: + status = subprocess.call(command, env=os.environ.copy()) + except FileNotFoundError: + raise FileNotFoundError( + Errors.E970.format(str_command=" ".join(command), tool=command[0]) + ) if status != 0: sys.exit(status)