mirror of
https://github.com/explosion/spaCy.git
synced 2025-07-05 12:23:06 +03:00
Only link model after download if shortcut link (#3378)
This commit is contained in:
parent
231bc7bb7b
commit
3fe5811fa7
|
@ -41,6 +41,14 @@ def download(model, direct=False, *pip_args):
|
||||||
dl = download_model(dl_tpl.format(m=model_name, v=version), 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
|
if dl != 0: # if download subprocess doesn't return 0, exit
|
||||||
sys.exit(dl)
|
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:
|
try:
|
||||||
# Get package path here because link uses
|
# Get package path here because link uses
|
||||||
# pip.get_installed_distributions() to check if model is a
|
# 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.
|
# message and loading instructions, even if linking fails.
|
||||||
msg.warn(
|
msg.warn(
|
||||||
"Download successful but linking failed",
|
"Download successful but linking failed",
|
||||||
"Creating a shortcut link for 'en' didn't work (maybe you "
|
"Creating a shortcut link for '{}' didn't work (maybe you "
|
||||||
"don't have admin permissions?), but you can still load the "
|
"don't have admin permissions?), but you can still load "
|
||||||
"model via its full package name: "
|
"the model via its full package name: "
|
||||||
"nlp = spacy.load('{}')".format(model_name),
|
"nlp = spacy.load('{}')".format(model, model_name),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user