diff --git a/doc/conf.py b/doc/conf.py index 229e25a017a9..8be29cf974ea 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -11,6 +11,7 @@ import os import shutil +import subprocess import sys import matplotlib @@ -141,8 +142,13 @@ def _check_deps(): master_doc = 'contents' # General substitutions. -from subprocess import check_output -SHA = check_output(['git', 'describe', '--dirty']).decode('utf-8').strip() +try: + SHA = subprocess.check_output( + ['git', 'describe', '--dirty']).decode('utf-8').strip() +# Catch the case where git is not installed locally, and use the versioneer +# version number instead +except (subprocess.CalledProcessError, FileNotFoundError): + SHA = matplotlib.__version__ html_context = {'sha': SHA}