Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pip 10: "pip list" warns "Cache entry deserialization failed, entry ignored" #5250

Closed
kkdd opened this issue Apr 16, 2018 · 27 comments · Fixed by #5521
Closed

pip 10: "pip list" warns "Cache entry deserialization failed, entry ignored" #5250

kkdd opened this issue Apr 16, 2018 · 27 comments · Fixed by #5521
Labels
auto-locked Outdated issues that have been locked by automation C: cache Dealing with cache and files in it project: vendored dependency Related to a vendored dependency type: bug A confirmed bug or unintended behavior
Milestone

Comments

@kkdd
Copy link

kkdd commented Apr 16, 2018

Hello,
pip v.10 repeatedly warns "Cache entry deserialization failed, entry ignored":

$ uname
Darwin
$ sw_vers
ProductName:	Mac OS X
ProductVersion:	10.13.4
BuildVersion:	17E199
$ brew info python@2
python@2: stable 2.7.14 (bottled), devel 2.7.15rc1, HEAD
Interpreted, interactive, object-oriented programming language
https://www.python.org/
/usr/local/Cellar/python@2/2.7.14_3 (4,603 files, 81.8MB) *
  Poured from bottle on 2018-03-10 at 22:25:36
 :
 :
$ brew info python3
python: stable 3.6.5 (bottled), devel 3.7.0b3, HEAD
Interpreted, interactive, object-oriented programming language
https://www.python.org/
/usr/local/Cellar/python/3.6.5 (4,768 files, 100.2MB) *
  Poured from bottle on 2018-03-30 at 20:43:21
 :
 :
$ pip2 -V
pip 10.0.0 from /usr/local/lib/python2.7/site-packages/pip (python 2.7)
$ pip3 -V
pip 10.0.0 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)
$ pip2 list --outdated
Package  Version Latest      Type 
-------- ------- ----------- -----
protobuf 3.5.1   3.5.2.post1 wheel
$ pip3 list --outdated
Cache entry deserialization failed, entry ignored
Cache entry deserialization failed, entry ignored
Cache entry deserialization failed, entry ignored
Cache entry deserialization failed, entry ignored
Cache entry deserialization failed, entry ignored
Cache entry deserialization failed, entry ignored
Cache entry deserialization failed, entry ignored
Cache entry deserialization failed, entry ignored
Cache entry deserialization failed, entry ignored
Cache entry deserialization failed, entry ignored
Cache entry deserialization failed, entry ignored
Cache entry deserialization failed, entry ignored
Cache entry deserialization failed, entry ignored
Cache entry deserialization failed, entry ignored
Cache entry deserialization failed, entry ignored
Cache entry deserialization failed, entry ignored
Cache entry deserialization failed, entry ignored
Cache entry deserialization failed, entry ignored
Cache entry deserialization failed, entry ignored
Cache entry deserialization failed, entry ignored
Cache entry deserialization failed, entry ignored
Cache entry deserialization failed, entry ignored
Cache entry deserialization failed, entry ignored
Cache entry deserialization failed, entry ignored
Package  Version Latest      Type 
-------- ------- ----------- -----
protobuf 3.5.1   3.5.2.post1 wheel
$ 
@japagetw
Copy link

I have also noted the same problem for the 64-bit versions of Windows 7 and 10 Professional. I see the problem only for Python 3.5 and not Python 2.7 or Python 3.6 (I have separate installations of all 3 versions). Adding --format legacy or --no-cache-dir makes the problem go away.

@jackton1
Copy link

Temporary Fix upgrade pip3 using.

curl https://bootstrap.pypa.io/get-pip.py | python3

Instead of pip install -U pip

For pip2 pip2 install --upgrade pip

@pradyunsg
Copy link
Member

It seems like you have messed up your pip cache. It's stored in ~/.cache/pip.

If you delete that directory, this issue should be fixed.

@pradyunsg pradyunsg added the S: awaiting response Waiting for a response/more information label Apr 17, 2018
@kkdd
Copy link
Author

kkdd commented Apr 18, 2018

Thank you. This phenomenon reproduces. I have confirmed that pip3 list --no-cache-dir --outdated works without warnings.

@japagetw
Copy link

I suspect that the problem is that cache entries created in Python 2 cannot be deserialized in Python 3. If I use the --cache-dir option to force different caches for Python 2 and Python 3, the problem goes away.

The error message is generated from C:\Python36\Lib\site-packages\pip_vendor\cachecontrol\controller.py line 139. The proximate cause is a failure of Serializer.loads() in C:\Python36\Lib\site-packages\pip_vendor\cachecontrol\serialize.py line 75.

@kkdd
Copy link
Author

kkdd commented Apr 19, 2018

Thank you. Your analysis sounds reasonable.

bryanwweber added a commit to bryanwweber/cantera that referenced this issue Apr 21, 2018
pip2 and pip3 used the same cache directory, resulting in a cache
invalidation warning because the Python 2 version of a package is not
compatible with Python 3. Using --no-cache-dir is recommended in
pypa/pip#5250
@xflr6
Copy link

xflr6 commented Apr 26, 2018

@pradyunsg: The problem is not fixed by deleting the cache dir (see the comment of @japagetw).

AFAIU, using --no-cache-dir on Python 3 is only a temporary workaround for this (i.e., it is a bug).

Can we make the shared cache dir for Python 2 and 3 work again (or is there a reason why the same version of pip >= 10 needs to use a different cache format on PY2 vs. PY3)?

@ssbarnea
Copy link
Contributor

This seems like a serious bug and one quick workaround should be to assure that cached entries filenames contain a serialisation version part inside them.

@pradyunsg pradyunsg added type: bug A confirmed bug or unintended behavior C: cache Dealing with cache and files in it and removed S: awaiting response Waiting for a response/more information S: needs triage Issues/PRs that need to be triaged labels May 16, 2018
@HakShak
Copy link

HakShak commented May 23, 2018

The fact that this is also on stderr is quite annoying.

@AronT-TLV
Copy link

AronT-TLV commented May 24, 2018

Deleting directory in .cache and creating 2 new ones pip2 and pip3 in that directory, solved the issue for me on one of my Macs temporarily, but not on another. Reinstalling pip3 via curl did not help. In fact, the problem appears inconsistently and mostly, but not exclusively, with pip3 not pip2.

@pradyunsg
Copy link
Member

pradyunsg commented May 24, 2018

This is likely due to a bug in the caching pipeline -- there's a bit of history with msgpack doing stuff incorrectly around bytes.

If someone can take a look into this, before one of the maintainers finds the time to, that would be cool. :)

@ssbarnea
Copy link
Contributor

ssbarnea commented May 31, 2018

Is anyone planning to do something about this newly introduced bug? pip should be updated ASAP to avoid clashing incompatible caches.

The workarounds mentioned here are not really applicable in all cases and are likely to cause more problems than sorting. Adding a versioning part in the cache entry naming would address this issue once for all, even if the cache format would change again.

Potentially every python package developer would encounter this issue if they use tox to test with multiple python versions. Please don't ask them to isolate the caches for each tox target, this defeats the purpose of having a cache.

@giganut
Copy link

giganut commented Jun 4, 2018

I'm having this problem as well.

@cosmiccamel
Copy link

Im having the same problem as well

@kamikaze
Copy link

kamikaze commented Jun 5, 2018

what happens?? too many bugs and problems since 9.0.1

@pradyunsg pradyunsg added this to the 18.0 milestone Jun 5, 2018
@ssbarnea
Copy link
Contributor

ssbarnea commented Jun 5, 2018

@HakShak The fact stderr is used is a good thing. POSIX specification documents and requires that all logging messages would go to stderr and not stdout, including errors, warnings, info, debug. Only the normal program output should go to stdin. This usually mean, for most tools: computer parsable output. For example on a package manager stdout should contain only installed/removed/upgraded packages, without the boilerplate which should go to stderr. I remember fixing few non compliant tools over the years. The output stream is not the issue here.

On the other hand, I just observed that this bug was added to the 18.0 milestone, not sure how to take this, as current version is 10.0. Is like a very long time in the future, or maybe I don't know about a plan to boost pip version to match current year?

@pradyunsg
Copy link
Member

Is like a very long time in the future, or maybe I don't know about a plan to boost pip version to match current year?

We switched to CalVer (#5324), 18.0 is going to be the next release of pip, likely next month.

@pradyunsg
Copy link
Member

I found that on Python 2, pip is able to use a cache populated by a Python 3 run but not vice versa.

A response cached on Py2 results in the cache storing a header that loads on Py3 as bytes instead of str. This causes the deserialization to fail. Working on a PR to fix it upstream.

@pradyunsg
Copy link
Member

Upstream PR: psf/cachecontrol#190

@hugovk
Copy link
Contributor

hugovk commented Jun 8, 2018

Upstream PR psf/cachecontrol#190 is merged and released in CacheControl 0.12.5.

@pradyunsg
Copy link
Member

pip will absorb that change when we update our vendored dependencies in preparation for the next release. :)

@Mavericks334
Copy link

I am having the same problem.

This is the error i get

Cache entry deserialization failed, entry ignored
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /simple/pip/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /simple/pip/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /simple/pip/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /simple/pip/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /simple/pip/
Requirement already up-to-date: pip in c:\programdata\anaconda3\lib\site-packages
You are using pip version 9.0.3, however version 18.0 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

How do i avoid this. Due to this i am unable to install any other packages since it is asking me to upgrade pip.

@etanot
Copy link
Contributor

etanot commented Nov 6, 2018

It seems like you have messed up your pip cache. It's stored in ~/.cache/pip.

If you delete that directory, this issue should be fixed.

I'm more interested in, what is cache entry deserialization?

@pradyunsg
Copy link
Member

#5250 (comment) elaborates on why it failed.

In essence, the error occurs due to a mismatch when converting an http request into a string (serialization). This error/warning shows up when trying to convert that string into an http request again (deserialization).

@IshikuUltra
Copy link

It seems like you have messed up your pip cache. It's stored in ~/.cache/pip.

If you delete that directory, this issue should be fixed.

Thank you so much.

@Gaopeng-Bai
Copy link

Easy to resolve this problem, run app or terminal as administrator

@lock
Copy link

lock bot commented May 28, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label May 28, 2019
@lock lock bot locked as resolved and limited conversation to collaborators May 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation C: cache Dealing with cache and files in it project: vendored dependency Related to a vendored dependency type: bug A confirmed bug or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.