-
Notifications
You must be signed in to change notification settings - Fork 287
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
jupyter_client 7.x implicitly depends on pyzmq>22.2.0 (matplotlib UnicodeDecodeError) #702
Comments
cc @martinRenou |
I believe it's the presence of In [1]: import json
In [2]: import simplejson
In [3]: d = dict(a=b'bytes')
In [4]: json.dumps(d, default=repr)
Out[4]: '{"a": "b\'bytes\'"}'
In [5]: simplejson.dumps(d, default=repr)
Out[5]: '{"a": "bytes"}' jupyter-client 7 relies on For some background: This issue would also go away if whatever code was putting bytes in a to-be-json dict did the |
@minrk thank you for the quick attention and the detailed explanation. So, I guess some recent refactors did not notice this behavior in simplejson because later versions of pyzmq had the In any event thank you very much! |
pyzmq's always used the stdlib json (once it was added in 2.6, at least), but it prefers simplejson if available. But that's true a lot less often these days, so it's almost always using the stdlib. That is, until 22.2, which removed support for alternative implementations so it's now always consistent with what was before only the most common behavior. You've pretty much got it - I think it was missed mainly due to the combination of:
so it would only come up if all three of these conditions are met:
which I suspect is a pretty small number of envs |
Got it! Our env checks all the bad boxes for sure. The culprit in my view is that we have made OpenStack client libraries available in our Jupyter environment, and those strongly prefer to be installed using a global set of requirements tied to major releases. So, when we install these clients we try to respect these requirements and constraints (there are also a LOT of dependencies that can be pulled in by these ;_;). I just checked and simplejson is in the list (doesn't necessarily mean anything, other than it's likely that some of the client libraries or their dependencies could pull it in), and there's an upper constraint pinning pyzmq to <22.2.0 in all but the most bleeding edge release branches of that thing. So that explains things some more. If others are mixing OpenStack libs with the latest Jupyter client presumably they would also have experienced this. Thanks again! |
I think this is a bug in the latest release and it regresses matplotlib for anybody who happens to have pyzmq < 22.2.0.
I was able to reproduce just by having a simple cell w/ a plot in an IPython notebook:
This will return the following output:
The issue seemed to be the JSON serialization of the IPython mimebundle-formatted outputs, which return dicts that have some of the values (the image contents) in bytes.
I couldn't find any obvious place where jupyter_client was doing the wrong thing, or a new thing, but PyZMQ has this in the 22.2.0 release notes:
I was able to fix my issues by upgrading past 22.2.0:
It does seem like 22.2.0 is the version that breaks things, if you
pip install --upgrade 'pyzmq<22.2.0
this will occur.The text was updated successfully, but these errors were encountered: