From 41ee75ac6dba87a6ea97dc4539fe1308a158c309 Mon Sep 17 00:00:00 2001 From: Pamphile ROY Date: Fri, 29 Jan 2021 15:37:44 +0100 Subject: [PATCH] Remove --no-cache-dir when downloading models When `--no-cache-dir` is present, it prevents caching to properly function. If the user still wants to do this, there is the possibility to pass options with `user_pip_args`. But you should not enforce options like these. In my case this is preventing some docker build (using buildkit caching) to have proper caching of models. --- spacy/cli/download.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/spacy/cli/download.py b/spacy/cli/download.py index 19f3e7860..85aaf3e5b 100644 --- a/spacy/cli/download.py +++ b/spacy/cli/download.py @@ -128,8 +128,6 @@ def get_version(model, comp): def download_model(filename, user_pip_args=None): download_url = about.__download_url__ + "/" + filename - pip_args = ["--no-cache-dir"] - if user_pip_args: - pip_args.extend(user_pip_args) + pip_args = user_pip_args if user_pip_args is not None else [] cmd = [sys.executable, "-m", "pip", "install"] + pip_args + [download_url] return subprocess.call(cmd, env=os.environ.copy())