From 1e5b4d85249ebdec6819df21663215fc6d04e4c0 Mon Sep 17 00:00:00 2001 From: Ines Montani Date: Mon, 22 Jun 2020 00:30:05 +0200 Subject: [PATCH] Fix DVC check --- spacy/cli/project.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spacy/cli/project.py b/spacy/cli/project.py index 8a97f67e0..c33f6a395 100644 --- a/spacy/cli/project.py +++ b/spacy/cli/project.py @@ -3,6 +3,7 @@ import typer import srsly from pathlib import Path from wasabi import msg +import subprocess import shlex import os import re @@ -28,12 +29,11 @@ project_cli = typer.Typer(help="Command-line interface for spaCy projects") @project_cli.callback(invoke_without_command=True) def callback(): # This runs before every project command and ensures DVC is installed - # TODO: check for "dvc" command instead of Python library? try: - import dvc # noqa: F401 - except ImportError: + subprocess.run(["dvc", "--version"], stdout=subprocess.DEVNULL) + except Exception: msg.fail( - "spaCy projects require DVC (Data Version Control)", + "spaCy projects require DVC (Data Version Control) and the 'dvc' command", "You can install the Python package from pip (pip install dvc) or " "conda (conda install -c conda-forge dvc). For more details, see the " "documentation: https://dvc.org/doc/install",