iqsharp jupyter kernel connection fails due to tornado timeout error
See original GitHub issueShort description: Unable to establish connection to Q# kernel in Jupyter notebook due to tornado\websocket.py timeout
Relevant error message: Traceback (most recent call last): File “C:\Users\koberm01.conda\envs\qsharp-env\lib\site-packages\tornado\websocket.py”, line 956, in _accept_connection await open_result tornado.util.TimeoutError: Timeout
Steps:
- Follow instructions for installing the IQ# kernel using conda at https://docs.microsoft.com/en-us/quantum/quickstarts/install-jupyter?tabs=tabid-conda. Note: launch conda prompt using Run as Admin option.
- Launch Jupyter from conda qsharp-env
- Create new Q# notebook with SampleQuantumRandomNumberGenerator code
- Unable to run notebook cells due to kernel connection issue as can be seen from log below
Expected behavior: Being able to execute the SampleQuantumRandomNumberGenerator code in a new Q# notebook.
Environment details: Windows 10 Enterprise Version 10.0.17763 Build 17763 conda 4.9.2 (Anaconda 64 bit installation) python 3.7.9 tornado 6.1 iqsharp 0.14.2011.120240 jupyter-core 4.7.0 dotnet 3.1.404
Steps taken to resolve (unsuccessful): a. Some research indicated that downgrading tornado to 5.1.1 may resolve the issue, but that was tried and triggered other errors so tornado was returned to 6.1. Example: https://github.com/tornadoweb/tornado/issues/2651 b. Also tried the option to install IQ# using .NET CLI. Installed without error but creating a new Q# Jupyter notebook produces the same error.
Output from conda prompt (Run as Admin):
(base) C:\windows\system32>conda activate qsharp-env
(qsharp-env) C:\windows\system32>python -c "import qsharp"
Preparing Q# environment...
(qsharp-env) C:\windows\system32>jupyter notebook
[I 10:00:25.072 NotebookApp] Serving notebooks from local directory: C:/ko-jupyter-notebooks
[I 10:00:25.072 NotebookApp] Jupyter Notebook 6.1.6 is running at:
[I 10:00:25.073 NotebookApp] http://localhost:8888/?token=67e7d25a2acd41b9f64873b0d0ac52bb0bd9ca1584ea7434
[I 10:00:25.073 NotebookApp] or http://127.0.0.1:8888/?token=67e7d25a2acd41b9f64873b0d0ac52bb0bd9ca1584ea7434
[I 10:00:25.074 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 10:00:25.240 NotebookApp]
To access the notebook, open this file in a browser:
file:///C:/Users/koberm01/AppData/Roaming/jupyter/runtime/nbserver-12136-open.html
Or copy and paste one of these URLs:
http://localhost:8888/?token=67e7d25a2acd41b9f64873b0d0ac52bb0bd9ca1584ea7434
or http://127.0.0.1:8888/?token=67e7d25a2acd41b9f64873b0d0ac52bb0bd9ca1584ea7434
[I 10:00:39.921 NotebookApp] Kernel started: 05b90f39-524b-4b7f-a950-aec261df8be2, name: iqsharp
[I 10:00:44.680 NotebookApp] Adapting from protocol version 5.2.0 (kernel 05b90f39-524b-4b7f-a950-aec261df8be2) to 5.3 (client).
[W 10:00:49.214 NotebookApp] Nudge: attempt 10 on kernel 05b90f39-524b-4b7f-a950-aec261df8be2
[W 10:00:54.214 NotebookApp] Nudge: attempt 20 on kernel 05b90f39-524b-4b7f-a950-aec261df8be2
[W 10:00:59.202 NotebookApp] Nudge: attempt 30 on kernel 05b90f39-524b-4b7f-a950-aec261df8be2
[W 10:01:04.213 NotebookApp] Nudge: attempt 40 on kernel 05b90f39-524b-4b7f-a950-aec261df8be2
[W 10:01:09.206 NotebookApp] Nudge: attempt 50 on kernel 05b90f39-524b-4b7f-a950-aec261df8be2
[W 10:01:14.213 NotebookApp] Nudge: attempt 60 on kernel 05b90f39-524b-4b7f-a950-aec261df8be2
[W 10:01:19.215 NotebookApp] Nudge: attempt 70 on kernel 05b90f39-524b-4b7f-a950-aec261df8be2
[W 10:01:24.235 NotebookApp] Nudge: attempt 80 on kernel 05b90f39-524b-4b7f-a950-aec261df8be2
[W 10:01:29.267 NotebookApp] Nudge: attempt 90 on kernel 05b90f39-524b-4b7f-a950-aec261df8be2
[W 10:01:34.279 NotebookApp] Nudge: attempt 100 on kernel 05b90f39-524b-4b7f-a950-aec261df8be2
[W 10:01:39.295 NotebookApp] Nudge: attempt 110 on kernel 05b90f39-524b-4b7f-a950-aec261df8be2
[W 10:01:44.282 NotebookApp] Nudge: attempt 120 on kernel 05b90f39-524b-4b7f-a950-aec261df8be2
[E 10:01:44.704 NotebookApp] Uncaught exception GET /api/kernels/05b90f39-524b-4b7f-a950-aec261df8be2/channels?session_id=e9e4538223d64b959245f8941e87102a (::1)
HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/api/kernels/05b90f39-524b-4b7f-a950-aec261df8be2/channels?session_id=e9e4538223d64b959245f8941e87102a', version='HTTP/1.1', remote_ip='::1')
Traceback (most recent call last):
File "C:\Users\koberm01\.conda\envs\qsharp-env\lib\site-packages\tornado\websocket.py", line 956, in _accept_connection
await open_result
tornado.util.TimeoutError: Timeout
[W 10:01:45.729 NotebookApp] Replacing stale connection: 05b90f39-524b-4b7f-a950-aec261df8be2:e9e4538223d64b959245f8941e87102a
[I 10:02:39.716 NotebookApp] Saving file at /QSharpPracticeKO/TestQSharp.ipynb
Screenshot of notebook:
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (3 by maintainers)
Hi all,
Thanks for reporting this issue. We’re aware of this timeout error, and we’re working on a fix that we expect to have available in the coming days. In the meantime, using a faster network connection can reduce the chances that you’ll get affected by this bug. We’ll update this issue in GitHub as soon as a fix becomes available.
QDK Team
@lfenster thank you for letting us know you’re seeing this problem! A new issue has been opened for it at #494. I tagged you there as well looking for debug logs of the issue, as we haven’t been able to reproduce it.