diff --git a/requirements.txt b/requirements.txt index 3a777f163..074775ae8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,6 +15,7 @@ numpy>=1.15.0 requests>=2.13.0,<3.0.0 tqdm>=4.38.0,<5.0.0 pydantic>=1.5.0,<1.7.0 +jinja2 # Official Python utilities setuptools packaging>=20.0 @@ -26,4 +27,3 @@ pytest>=4.6.5 pytest-timeout>=1.3.0,<2.0.0 mock>=2.0.0,<3.0.0 flake8>=3.5.0,<3.6.0 -jinja2 diff --git a/spacy/cli/init_config.py b/spacy/cli/init_config.py index 9f73b17ae..ff11f97f6 100644 --- a/spacy/cli/init_config.py +++ b/spacy/cli/init_config.py @@ -5,6 +5,7 @@ from wasabi import Printer, diff_strings from thinc.api import Config import srsly import re +from jinja2 import Template from .. import util from ..language import DEFAULT_CONFIG_PRETRAIN_PATH @@ -127,10 +128,6 @@ def init_config( ) -> None: is_stdout = str(output_file) == "-" msg = Printer(no_print=is_stdout) - try: - from jinja2 import Template - except ImportError: - msg.fail("This command requires jinja2", "pip install jinja2", exits=1) with TEMPLATE_PATH.open("r") as f: template = Template(f.read()) # Filter out duplicates since tok2vec and transformer are added by template