-
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
Import error on shutdown/KeyboardInterrupt if ran from Jupyter Lab notebook cell #20317
Comments
Avoid exit(1): In a Jupyter environment, exit() can cause problems. exit is possible in standard Python scripts, but should not be called in Jupyter notebooks. You can use sys.exit() instead: However, the recommended approach is to avoid using exit() or sys.exit() directly, especially in Jupyter notebook environments, where these commands can interrupt the kernel process and cause unnecessary problems. |
@nocoding03 My code/notebook does not use or calls exit. The problem is in the pytroch lightning module. If you will double-check the provided traceback, you will see that the error comes from ~/.local/lib/python3.10/site-packages/lightning/pytorch/trainer/call.py module. |
I also see that issue in lightning v2.4.0 and torch v2.5.1 while training in jupyter nb.
seems to be an issue with lightning not importing exit from sys (exit(0)) not defined |
same issue in 2.5.0 - but it even fails when defining the trainer and kills the kernel |
What's the status of this? The bug was reported 5 months ago in that specific branch #19976 authored by @awaelchli and approved by @lantiga. There seems to be no activity in fixing this. My understanding is that importing exit from sys should be sufficient to fix it but I might miss something. |
Bug description
Import error on shutdown/KeyboardInterrupt if ran from Jupyter Lab notebook cell. If ran from script everything works fine.
What version are you seeing the problem on?
v2.4
How to reproduce the bug
Error messages and logs
Environment
Current environment
More info
No response
The text was updated successfully, but these errors were encountered: