Only link model after download if shortcut link
@@ -41,6 +41,14 @@ def download(model, direct=False, *pip_args):
dl = download_model(dl_tpl.format(m=model_name, v=version), pip_args)
if dl != 0: # if download subprocess doesn't return 0, exit
sys.exit(dl)
+ msg.good(
+ "Download and installation successful",
+ "You can now load the model via spacy.load('{}')".format(model_name),
+ )
+ # Only create symlink if the model is installed via a shortcut like 'en'.
+ # There's no real advantage over an additional symlink for en_core_web_sm
+ # and if anything, it's more error prone and causes more confusion.
+ if model in shortcuts:
try:
# Get package path here because link uses
# pip.get_installed_distributions() to check if model is a
@@ -54,10 +62,10 @@ def download(model, direct=False, *pip_args):
# message and loading instructions, even if linking fails.
msg.warn(
"Download successful but linking failed",
- "Creating a shortcut link for 'en' didn't work (maybe you "
- "don't have admin permissions?), but you can still load the "
- "model via its full package name: "
- "nlp = spacy.load('{}')".format(model_name),
+ "Creating a shortcut link for '{}' didn't work (maybe you "
+ "don't have admin permissions?), but you can still load "
+ "the model via its full package name: "
+ "nlp = spacy.load('{}')".format(model, model_name),
)
