Update resolve_model_name
@@ -88,10 +88,11 @@ def fix_glove_vectors_loading(overrides):
def resolve_model_name(name):
- """If spaCy is loaded with 'en' or 'de', check if symlink already exists. If
+ """If spaCy is loaded with 'de', check if symlink already exists. If
not, user have upgraded from older version and have old models installed.
Check if old model directory exists and if so, return that instead and create
- shortcut link.
+ shortcut link. If English model is found and no shortcut exists, raise error
+ and tell user to install new model.
"""
if name == 'en' or name == 'de':
@@ -99,11 +100,19 @@ def resolve_model_name(name):
data_path = Path(util.get_data_path())
model_path = data_path / name
v_model_paths = [data_path / Path(name + '-' + v) for v in versions]
- if not model_path.exists():
+
+ if not model_path.exists(): # no shortcut found
for v_path in v_model_paths:
- if v_path.exists():
+ if v_path.exists(): # versioned model directory found
+ if name == 'de':
link(v_path, name)
return name
+ else:
+ raise ValueError(
+ "Found English model at {p}. This model is not "
+ "compatible with the current version. See "
+ "https://spacy.io/docs/usage/models to download the "
+ "new model.".format(p=v_path))
return name
