-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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 lab crashes when executing code with the python decimal module and precision 1 #16268
Comments
Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! 🤗 |
I can reproduce this in a tip-of- |
I was unable to reproduce this in a terminal with IPython 8.22.2; this seems to be specific to JupyterLab. @eendebakpt Thank you for reporting this! |
@JasonWeill can you try again? I was able to reproduce this in the terminal with IPython 8.26.0 and Jupyter console 6.6.3 by typing import decimal
d = decimal.Decimal('1001')
con = decimal.getcontext()
con.prec = 1
print('first cell') then print('second cell') The Jupyter console is then totally unresponsive. Also exactly the same failure happens in CoCalc, which shares no code with JupyterLab. This might be a problem in the implementation of ipykernel in Python, which has nothing to do with Jupyterlab or frontends. I think it's misleading to say that "Jupyter lab crashes" in this case. It's more that the backend kernel crashes, and JupyterLab can't do anything further with it. I don't know what JupyterLab could do better in this case. Context: I just went through and triaged all the CoCalc Jupyter issues, and decided to test whether some of the JupyterLab bugs were also CoCalc Jupyter bugs, and this was the first one I tried. It's nice that we have two very similar clients with distinct implementations. Additional context: I remember having a long chat with Brian Granger at Scipy 2006 at Caltech about how kernels should work. In Sage we used pexpect and he wanted to use something different (eventually zmq), and my argument for pexpect was that you could always see any crashes, like in a terminal, whereas with zmq, if the kernel gets broke somehow, you might not be able to observe it, since the mechanism of observation itself breaks. Obviously overall zmq is much more efficient than pexpect, but this is the sort of issue I was concerned about. |
@williamstein Thanks for clarifying! I was testing with IPython, but I hadn't had Jupyter Console installed. With Jupyter Console 6.6.3 and IPython 8.24.0 installed, I see the same error as in your screen shot above. There is one IPyKernel issue that mentions decimal precision: ipython/ipykernel#494 — although it seems to be related to ipython/ipython#11565, which is closed, and which is not specific to the I see that ipython/ipykernel#1124 has the same "UserWarning: The kernel did not respond to an is_complete_request" message as in this issue. This was fixed in ipython/ipykernel#1237 , which was released in IPyKernel 6.29.5. I'm running 6.29.3. |
After upgrading to I can open a new issue in https://github.com/ipython/ipykernel/issues and I'll block this issue on the new issue. Thanks again @williamstein ! |
Blocked on ipython/ipykernel#1259. |
Description
When importing the python builtin module
decimal
and setting the precision to 1 every second cell executed in jupyter lab freezes. The same code runs without problems in plain python.Reproduce
Run the following code cells in Jupyter lab
The execution of the second cell fails, even though the code there is just a print statement.
On the console where jupyter lab was started is some output that might be helpful.
The same problem also occurs in Spyder. It seems related to the communication with the kernel that is running in the background.
Expected behavior
Even though the code itself might raise exceptions, jupyter lab should not freeze. The minimal example above might be a bit odd, but the more realistic case where the issue was encountered is not suitable for a minimal example.
Context
Troubleshoot Output
Command Line Output
Browser Output
The text was updated successfully, but these errors were encountered: