Closed boehmc closed 2 years ago
Thanks for reporting. I believe this should be fixed in jupyter_client
. I'll see what I can do.
Actually I believe this should be fixed here in pythreejs. Python's math.inf
is now properly serialized to Infinity
(valid JSON) instead of 'inf'
. So we can remove all the workarounds:
Awesome! Thanks so much for your swift reply and for looking into it!
Let me know if I can help and work on a pull request.
is now properly serialized to Infinity (valid JSON)
I was wrong. Infinity and NaN are not part of the JSON specification, even though it's valid JavaScript and JavaScript decoders supports it.
The issue comes from https://github.com/ipython/ipykernel/pull/708 specifically, as Infinity and NaN are not being "cleaned" anymore.
For now I can only suggest either downgrading ipykernel to <6.4 or jupyter_client to <7.
I am trying to push a fix to jupyter_client
directly ASAP
Awesome, thanks a lot!
This will be fixed by https://github.com/jupyter/jupyter_client/pull/708 (at least, we will only see a Warning but the widget will work again)
Though we will need to update pythreejs at some point, having a custom serializer to support Infinity/NaN, as it's not valid JSON, similar to what ipydatagrid does: https://github.com/bloomberg/ipydatagrid/blob/main/ipydatagrid/datagrid.py#L172-L178
Yeah, we should make some serializers for "extended floats"..
any update on this? I'm having to downgrade my jupyter_client version in the meantime
Fix proposed in #378 (this commit: https://github.com/jupyter-widgets/pythreejs/pull/378/commits/f294530d7b7d5e6e7469360f34fd0770a7485a31)
Hello vidartf,
Please pardon me for not following proper protocol. I just posted the following message to you at https://github.com/jupyter-widgets/pythreejs/pull/378
I’m a newbie programmer working with Jupyter Notebook and pythreejs.
All 3 of my project files at https://github.com/LtAirman/ChargeFieldTopics stopped working this morning. They no longer display the pythreejs rendered scene.
Over the last few months the cell setting up the rendered scene displayed a UserWarning, due to non JSON compliant infinite values. I believe you identified the problem, involving the pythreejs orbital camera, in issues 366 and 378 which I’ve been following.
It was my impression this non-finite number problem would be corrected with the upcoming ipywidget 8 release, seeing no rendered output at all is an awful surprise. What do I do now?
I’d appreciate any guidance or information you might provide in this matter.
Update, happy to report my projects' pythreejs rendered outputs are now working properly. Along with the UserWarning that is. I double posted this message at https://github.com/jupyter-widgets/pythreejs/pull/378.
I believe a recent change in the json serialization within
jupyter_client
leads to the following error when trying to useOrbitControls
in a jupyter notebook.The issue is caused by default values of
+/- Inf
for some parameters inOrbitControls
This can also be seen in the second cell of the built-in example.
Here is a minimal (non)-working example:
Removing the commented lines will insert finite values for all parameters that would default
to +/- Inf
otherwise, after which the serialization works again.System info: