The Python Oracle

pip uses incorrect cached package version, instead of the user-specified version

Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn

--

Music by Eric Matyas
https://www.soundimage.org
Track title: Lost Meadow

--

Chapters
00:00 Question
00:50 Accepted answer (Score 676)
01:10 Answer 2 (Score 623)
01:56 Answer 3 (Score 327)
04:31 Answer 4 (Score 109)
05:01 Thank you

--

Full question
https://stackoverflow.com/questions/9510...

Accepted answer links:
[source]: https://pip.pypa.io/en/stable/reference/...

Answer 3 links:
[the official docs]: https://pip.pypa.io/en/stable/topics/cac...
[pip config]: https://pip.pypa.io/en/stable/cli/pip_co.../
[here]: https://pip.pypa.io/en/stable/topics/con.../
[pip cache]: https://pip.pypa.io/en/stable/cli/pip_ca.../

Answer 4 links:
https://pip.pypa.io/en/latest/reference/...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #pip

#avk47



ACCEPTED ANSWER

Score 730


If using pip 6.0 or newer, try adding the --no-cache-dir option (source).

If using pip older than pip 6.0, upgrade it with pip install -U pip.




ANSWER 2

Score 645


Clear the cache directory where appropriate for your system

Linux and Unix

~/.cache/pip  # and it respects the XDG_CACHE_HOME directory.

OS X

~/Library/Caches/pip

Windows

%LocalAppData%\pip\Cache

UPDATE

With pip 20.1 or later, you can find the full path for your operating system easily by typing this in the command line:

pip cache dir

Example output on my Ubuntu installation:

➜ pip3 cache dir
/home/tawanda/.cache/pip



ANSWER 3

Score 109


From documentation at https://pip.pypa.io/en/latest/reference/pip_install.html#caching:

Starting with v6.0, pip provides an on-by-default cache which functions similarly to that of a web browser. While the cache is on by default and is designed do the right thing by default you can disable the cache and always access PyPI by utilizing the --no-cache-dir option.




ANSWER 4

Score 95


pip can install a package ignoring the cache, like this

pip --no-cache-dir install scipy