-
Notifications
You must be signed in to change notification settings - Fork 25
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
RuntimeError: "This event loop is already running" with nbclient==0.8.0 #435
Comments
Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! 🤗 |
Have the exact same issue. Have tried a variety of things already, still getting the same response. |
try Downgrade jupyter_core to 5.3.1 |
Thank you very much sir @samuelan, resolved. |
It made this problem go away for me too. Thank you 🙏 Do we close this issue or leave it open since it's still a problem with 5.3.2? |
I found the issue with jupyter_core==5.3.2 with a different problem that I had. I haven't figured out the exact steps to reproduce the issue without sharing internal codes. If you folks have a simplified reproduction scenario you can share here, that'd be great. I commented on one PR in jupyter_core which change the way event loop was handled in run_sync function. The author of that PR was asking my repro, and so far I am not able to give him that. |
I'm guessing that reproducing my environment would probably do it. I could probably do it with some kind of sandbox that supports python. |
I am having a similar issue, but I am installing most packages with conda install and my jupyter_core=5.4.0 and nbclient=0.8.0 and I am running into similar errors. I have tried downgrading to jupyter_core=5.3.1 and still get the same error. I am running user instances via jupyterhub-singleuser. From other posts, I have also tried to set nbclient=0.7.1 and issue still persists. I have seen other posts about asyncio python module, but they were older so assuming this is not the issue. |
For me, the combination that worked was I have seen nbclient==0.5.13 and nbclassic==0.4.7 being not compatible/broken with jupyter_core==5.3.1. So jupyter_core==5.3.1 by itself is not a silver bullet. The PR that change the event loop was in jupyter/jupyter_core#362, and I made a comment there about that. I have not been able to reproduce the same problem with simple Python codes on my laptop, but once I do, I will post here and over there at jupyter_core about it. |
@samuelan Thanks for the prompt response. I did not have any luck with the settings above. Before I started any version modifications I was at: jupyter_core==5.4.0 I am actually running on Amazon2 kernel if that helps. I am not using containers either, long story as to why not, but customer is always right. :) I typically create a base environment, and then I run "conda list --explicit > user.txt" and build/create user envs from that. @samuelan Sorry for being an idiot. The settings you provided above worked when I dropped them into the base environment as I run "jupyterhub" process is ec2-user from which my pre_spawn_script creates a user env if it does not exist. So finally paid closer attention to the logs and realized that it was failing in base jupyterhub. Sorry about that. I will keep an eye out for any additional updates. I left my comments above so that you had the full story. |
@gbellvelocity no worries. Glad it worked for ya. |
@samuelan @taras Hey folks, I just ran into this issue myself. Sorry for the lack of communication from us maintainers on this issue, we've been super busy as of late 😓. First, I want to document a few things explicitly:
I see that @samuelan went the extra mile and did some great investigatory work, tracing the bug to jupyter/jupyter_core#362. I have a pretty solid understanding of async and Jupyter, so I think I can fix this bug directly on Thank you all for using, contributing, and debugging Jupyter Scheduler! Love the support. |
Thanks a lot, @dlqqq. I tried multiple rounds of reproducing the problem with simpler setup in vain. The codes that crashed for me was in executors.py, where I customized it and used a the PR362 in jupyter_core does not create new event loop each time, but try to reuse existing running loop. but I could not figure out what caused the sanity check in asyncio.base_events to fail. supposedly after a new event loop is created for the current process/thread, it's not supposed to be running till run_until_complete or run_forever is called. In any case, it sounds like you got a good handle on this. I will stay tuned to your fix. Thanks a lot, @dlqqq! |
Hey folks! Good news. I found the root cause of the bug. It turns out that this bug has an oddly specific set of conditions to manifest:
I'm closing the issue for now as it will be fixed in the next release, which will occur in the next 24 hours. @samuelan You might be interested in the technical details of this bug. It's a three-way interaction between |
@dlqqq, thank you so much! No wonder I could not reproduce it locally. So it had to be on Linux, while I was on a Mac trying to reproduce. Right ahead of Halloween, this is rather wicked bug. Really appreciate solving it for us. |
Hello, I am currently having the exact same error with the conditions as @dlqqq mentioned:
|
@guigoruiz1 This is fixed in |
Related #330 but happening with nbclient==0.8.0
Description
When I execute a job, I get "This event loop is already running" error in the UI.
In the service logs, I get the following error.
Reproduce
I'm using mamba to install Jupyter Notebook & JupyterLab and PIP to install Jupyter scheduler.
Expected behavior
Would love to be able to run jobs :(
Context
The text was updated successfully, but these errors were encountered: