-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
asyncio.exceptions.InvalidStateError: invalid state
when restarting external kernel
#21338
Comments
Hey @vindi97, thanks for reporting. This seems like a legit error but I don't understand what's causing it. @blink1073, could you take a look at this one? Perhaps this exception needs to be caught in Jupyter-client. |
asyncio.exceptions.InvalidStateError: invalid state
when restarting external kernel
I think this is the same root cause as jupyter/jupyter_client#959. I proposed a fix here, we're waiting on someone to be able to confirm, since I haven't been able to repro. |
@vindi97, could you help us to check that? We can guide you on how to apply @blink1073's patch. |
@
Please guide me |
Ok, thanks for your help @vindi97! First, you need to navigate to this directory:
look for the file called After that, please search for the following text:
That should point to a single line (line 163 or close that one). Finally, please replace the three lines below that one # Run the loop for this thread.
if name not in _loop_map:
_loop_map[name] = asyncio.new_event_loop()
loop = _loop_map[name] with these lines instead # Run the loop for this thread.
try:
loop = asyncio.get_event_loop()
except RuntimeError:
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop) If you're using Spyder to edit the file, close it and start it again. If everything goes well, you shouldn't see the error you reported above. |
@blink1073, on issue #21371 @vindi97 confirmed that your patch solves the problem reported here (now @vindi97 is having a different one). Thanks for your input! |
Great! I'll apply the fix and make a release in |
Closing because this was fixed in Jupyter-core 5.3.2. |
Description
What steps will reproduce the problem?
Wehn i change the interpreter and try to restart the kernel
Traceback
Versions
Dependencies
Environment
Environment
The text was updated successfully, but these errors were encountered: