Skip to content

Commit

Permalink
Only download model if not installed (see #1456)
Browse files Browse the repository at this point in the history
Use #egg=model==version to allow pip to check for existing installations. The download is only started if no installation matching the package/version is found. Fixes a long-standing inconvenience.
  • Loading branch information
ines committed May 20, 2018
1 parent 6e6f995 commit 8bcf5e9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions spacy/cli/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ def download(model, direct=False):
with version.
"""
if direct:
dl = download_model('{m}/{m}.tar.gz'.format(m=model))
dl = download_model('{m}/{m}.tar.gz#egg={m}'.format(m=model))
else:
shortcuts = get_json(about.__shortcuts__, "available shortcuts")
model_name = shortcuts.get(model, model)
compatibility = get_compatibility()
version = get_version(model_name, compatibility)
dl = download_model('{m}-{v}/{m}-{v}.tar.gz'.format(m=model_name,
v=version))
dl = download_model('{m}-{v}/{m}-{v}.tar.gz#egg={m}=={v}'
.format(m=model_name, v=version))
if dl != 0: # if download subprocess doesn't return 0, exit
sys.exit(dl)
try:
Expand Down

0 comments on commit 8bcf5e9

Please sign in to comment.