Skip to content
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

Jupyterlab-lsp Error: Uncaught Exception GET /lsp/ws/pyls (::1) #1067

Closed
HMiao-Ian opened this issue Mar 5, 2024 · 5 comments · Fixed by #1069
Closed

Jupyterlab-lsp Error: Uncaught Exception GET /lsp/ws/pyls (::1) #1067

HMiao-Ian opened this issue Mar 5, 2024 · 5 comments · Fixed by #1069

Comments

@HMiao-Ian
Copy link

HMiao-Ian commented Mar 5, 2024

Description

I have installed Miniconda in my Windows 10 operating system.

I want to use jupyterlab-lsp, so I just create a virtual environment named GitENV and
install required dependencies.

After installing dependencies, I use jupyter lab to open the jupyterlab. The Anaconda Prompt(Miniconda) shows error information.
The error information is in Command Line Output.

Reproduce

  1. conda create -n GitENV python=3.10
  2. pip3 install jupyterlab==4.1.2
  3. pip3 install jedi==0.17.2
  4. pip3 install python-language-server==0.36.2
  5. pip3 install jupyterlab-lsp==5.1.0
  6. conda install nodejs=18.16.0

Expected behavior

I use commands above to install jupyterlab-lsp and python-language-server, and I expect I can use them wihout error information. But error occurred. And In jupyterlab webpage, the jupyterlab-lsp item at the bottom of the page shows connecting or initializing. It should be Initialized.
20240305095711

Context

  • Operating System and version: Windows 10, 20H2.
  • Browser and version: Chrome, 122.0.6261.95.
  • JupyterLab version: 4.1.2.
  • Language server and version: python-language-server, 0.36.2.
Required: installed server extensions
Paste the output from running `jupyter server extension list` from the command line here.
You may want to sanitize the paths in the output.
Required: installed lab extensions
Paste the output from running `jupyter labextension list` from the command line here.
You may want to sanitize the paths in the output.
Troubleshoot Output
sys.executable:
        D:\Yann\miniconda3\envs\GitENV\python.exe

sys.version:
3.10.13 | packaged by conda-forge | (main, Dec 23 2023, 15:27:34) [MSC v.1937 64 bit (AMD64)]

platform.platform():
Windows-10-10.0.19042-SP0

where jupyter:
D:\Yann\miniconda3\envs\GitENV\Scripts\jupyter.exe
D:\Yann\miniconda3\Scripts\jupyter.exe

pip list:
Package Version
------------------------- ---------------
anyio 4.3.0
argon2-cffi 23.1.0
argon2-cffi-bindings 21.2.0
arrow 1.3.0
asttokens 2.4.1
async-lru 2.0.4
attrs 23.2.0
Babel 2.14.0
beautifulsoup4 4.12.3
bleach 6.1.0
certifi 2024.2.2
cffi 1.16.0
charset-normalizer 3.3.2
colorama 0.4.6
comm 0.2.1
debugpy 1.8.1
decorator 5.1.1
defusedxml 0.7.1
docstring-to-markdown 0.15
exceptiongroup 1.2.0
executing 2.0.1
fastjsonschema 2.19.1
fqdn 1.5.1
h11 0.14.0
httpcore 1.0.4
httpx 0.27.0
idna 3.6
ipykernel 6.29.3
ipython 8.22.2
isoduration 20.11.0
jedi 0.17.2
Jinja2 3.1.3
json5 0.9.20
jsonpointer 2.4
jsonschema 4.21.1
jsonschema-specifications 2023.12.1
jupyter_client 8.6.0
jupyter_core 5.7.1
jupyter-events 0.9.0
jupyter-lsp 2.2.3
jupyter_server 2.13.0
jupyter_server_terminals 0.5.2
jupyterlab 4.1.2
jupyterlab-lsp 5.1.0
jupyterlab_pygments 0.3.0
jupyterlab_server 2.25.3
jupyterlab-vim 4.1.3
MarkupSafe 2.1.5
matplotlib-inline 0.1.6
mistune 3.0.2
nbclient 0.9.0
nbconvert 7.16.1
nbformat 5.9.2
nest-asyncio 1.6.0
notebook_shim 0.2.4
overrides 7.7.0
packaging 23.2
pandocfilters 1.5.1
parso 0.7.1
pip 24.0
platformdirs 4.2.0
pluggy 1.4.0
prometheus_client 0.20.0
prompt-toolkit 3.0.43
psutil 5.9.8
pure-eval 0.2.2
pycparser 2.21
Pygments 2.17.2
python-dateutil 2.9.0.post0
python-json-logger 2.0.7
python-jsonrpc-server 0.4.0
python-language-server 0.36.2
python-lsp-jsonrpc 1.1.2
pywin32 306
pywinpty 2.0.13
PyYAML 6.0.1
pyzmq 25.1.2
referencing 0.33.0
requests 2.31.0
rfc3339-validator 0.1.4
rfc3986-validator 0.1.1
rpds-py 0.18.0
Send2Trash 1.8.2
setuptools 69.1.1
six 1.16.0
sniffio 1.3.1
soupsieve 2.5
stack-data 0.6.3
terminado 0.18.0
tinycss2 1.2.1
tomli 2.0.1
tornado 6.4
traitlets 5.14.1
types-python-dateutil 2.8.19.20240106
typing_extensions 4.10.0
ujson 5.9.0
uri-template 1.3.0
urllib3 2.2.1
wcwidth 0.2.13
webcolors 1.13
webencodings 0.5.1
websocket-client 1.7.0
wheel 0.42.0

conda list:
# packages in environment at D:\Yann\miniconda3\envs\GitENV:
#
# Name Version Build Channel
anyio 4.3.0 pypi_0 pypi
argon2-cffi 23.1.0 pypi_0 pypi
argon2-cffi-bindings 21.2.0 pypi_0 pypi
arrow 1.3.0 pypi_0 pypi
asttokens 2.4.1 pypi_0 pypi
async-lru 2.0.4 pypi_0 pypi
attrs 23.2.0 pypi_0 pypi
babel 2.14.0 pypi_0 pypi
beautifulsoup4 4.12.3 pypi_0 pypi
bleach 6.1.0 pypi_0 pypi
bzip2 1.0.8 hcfcfb64_5 conda-forge
ca-certificates 2024.2.2 h56e8100_0 conda-forge
certifi 2024.2.2 pypi_0 pypi
cffi 1.16.0 pypi_0 pypi
charset-normalizer 3.3.2 pypi_0 pypi
colorama 0.4.6 pypi_0 pypi
comm 0.2.1 pypi_0 pypi
debugpy 1.8.1 pypi_0 pypi
decorator 5.1.1 pypi_0 pypi
defusedxml 0.7.1 pypi_0 pypi
docstring-to-markdown 0.15 pypi_0 pypi
exceptiongroup 1.2.0 pypi_0 pypi
executing 2.0.1 pypi_0 pypi
fastjsonschema 2.19.1 pypi_0 pypi
fqdn 1.5.1 pypi_0 pypi
h11 0.14.0 pypi_0 pypi
httpcore 1.0.4 pypi_0 pypi
httpx 0.27.0 pypi_0 pypi
icu 73.2 h63175ca_0 conda-forge
idna 3.6 pypi_0 pypi
ipykernel 6.29.3 pypi_0 pypi
ipython 8.22.2 pypi_0 pypi
isoduration 20.11.0 pypi_0 pypi
jedi 0.17.2 pypi_0 pypi
jinja2 3.1.3 pypi_0 pypi
json5 0.9.20 pypi_0 pypi
jsonpointer 2.4 pypi_0 pypi
jsonschema 4.21.1 pypi_0 pypi
jsonschema-specifications 2023.12.1 pypi_0 pypi
jupyter-client 8.6.0 pypi_0 pypi
jupyter-core 5.7.1 pypi_0 pypi
jupyter-events 0.9.0 pypi_0 pypi
jupyter-lsp 2.2.3 pypi_0 pypi
jupyter-server 2.13.0 pypi_0 pypi
jupyter-server-terminals 0.5.2 pypi_0 pypi
jupyterlab 4.1.2 pypi_0 pypi
jupyterlab-lsp 5.1.0 pypi_0 pypi
jupyterlab-pygments 0.3.0 pypi_0 pypi
jupyterlab-server 2.25.3 pypi_0 pypi
jupyterlab-vim 4.1.3 pypi_0 pypi
libffi 3.4.2 h8ffe710_5 conda-forge
libsqlite 3.45.1 hcfcfb64_0 conda-forge
libzlib 1.2.13 hcfcfb64_5 conda-forge
markupsafe 2.1.5 pypi_0 pypi
matplotlib-inline 0.1.6 pypi_0 pypi
mistune 3.0.2 pypi_0 pypi
nbclient 0.9.0 pypi_0 pypi
nbconvert 7.16.1 pypi_0 pypi
nbformat 5.9.2 pypi_0 pypi
nest-asyncio 1.6.0 pypi_0 pypi
nodejs 18.16.0 haa95532_1
notebook-shim 0.2.4 pypi_0 pypi
openssl 3.2.1 hcfcfb64_0 conda-forge
overrides 7.7.0 pypi_0 pypi
packaging 23.2 pypi_0 pypi
pandocfilters 1.5.1 pypi_0 pypi
parso 0.7.1 pypi_0 pypi
pip 24.0 pyhd8ed1ab_0 conda-forge
platformdirs 4.2.0 pypi_0 pypi
pluggy 1.4.0 pypi_0 pypi
prometheus-client 0.20.0 pypi_0 pypi
prompt-toolkit 3.0.43 pypi_0 pypi
psutil 5.9.8 pypi_0 pypi
pure-eval 0.2.2 pypi_0 pypi
pycparser 2.21 pypi_0 pypi
pygments 2.17.2 pypi_0 pypi
python 3.10.13 h4de0772_1_cpython conda-forge
python-dateutil 2.9.0.post0 pypi_0 pypi
python-json-logger 2.0.7 pypi_0 pypi
python-jsonrpc-server 0.4.0 pypi_0 pypi
python-language-server 0.36.2 pypi_0 pypi
python-lsp-jsonrpc 1.1.2 pypi_0 pypi
pywin32 306 pypi_0 pypi
pywinpty 2.0.13 pypi_0 pypi
pyyaml 6.0.1 pypi_0 pypi
pyzmq 25.1.2 pypi_0 pypi
referencing 0.33.0 pypi_0 pypi
requests 2.31.0 pypi_0 pypi
rfc3339-validator 0.1.4 pypi_0 pypi
rfc3986-validator 0.1.1 pypi_0 pypi
rpds-py 0.18.0 pypi_0 pypi
send2trash 1.8.2 pypi_0 pypi
setuptools 69.1.1 pyhd8ed1ab_0 conda-forge
six 1.16.0 pypi_0 pypi
sniffio 1.3.1 pypi_0 pypi
soupsieve 2.5 pypi_0 pypi
stack-data 0.6.3 pypi_0 pypi
terminado 0.18.0 pypi_0 pypi
tinycss2 1.2.1 pypi_0 pypi
tk 8.6.13 h5226925_1 conda-forge
tomli 2.0.1 pypi_0 pypi
tornado 6.4 pypi_0 pypi
traitlets 5.14.1 pypi_0 pypi
types-python-dateutil 2.8.19.20240106 pypi_0 pypi
typing-extensions 4.10.0 pypi_0 pypi
tzdata 2024a h0c530f3_0 conda-forge
ucrt 10.0.22621.0 h57928b3_0 conda-forge
ujson 5.9.0 pypi_0 pypi
uri-template 1.3.0 pypi_0 pypi
urllib3 2.2.1 pypi_0 pypi
vc 14.3 hcf57466_18 conda-forge
vc14_runtime 14.38.33130 h82b7239_18 conda-forge
vs2015_runtime 14.38.33130 hcb4865c_18 conda-forge
wcwidth 0.2.13 pypi_0 pypi
webcolors 1.13 pypi_0 pypi
webencodings 0.5.1 pypi_0 pypi
websocket-client 1.7.0 pypi_0 pypi
wheel 0.42.0 pyhd8ed1ab_0 conda-forge
xz 5.2.6 h8d14728_0 conda-forge

conda env:
name: GitENV
channels:
- conda-forge
- defaults
dependencies:
- bzip2=1.0.8=hcfcfb64_5
- ca-certificates=2024.2.2=h56e8100_0
- icu=73.2=h63175ca_0
- libffi=3.4.2=h8ffe710_5
- libsqlite=3.45.1=hcfcfb64_0
- libzlib=1.2.13=hcfcfb64_5
- nodejs=18.16.0=haa95532_1
- openssl=3.2.1=hcfcfb64_0
- pip=24.0=pyhd8ed1ab_0
- python=3.10.13=h4de0772_1_cpython
- setuptools=69.1.1=pyhd8ed1ab_0
- tk=8.6.13=h5226925_1
- tzdata=2024a=h0c530f3_0
- ucrt=10.0.22621.0=h57928b3_0
- vc=14.3=hcf57466_18
- vc14_runtime=14.38.33130=h82b7239_18
- vs2015_runtime=14.38.33130=hcb4865c_18
- wheel=0.42.0=pyhd8ed1ab_0
- xz=5.2.6=h8d14728_0
- pip:
- anyio==4.3.0
- argon2-cffi==23.1.0
- argon2-cffi-bindings==21.2.0
- arrow==1.3.0
- asttokens==2.4.1
- async-lru==2.0.4
- attrs==23.2.0
- babel==2.14.0
- beautifulsoup4==4.12.3
- bleach==6.1.0
- certifi==2024.2.2
- cffi==1.16.0
- charset-normalizer==3.3.2
- colorama==0.4.6
- comm==0.2.1
- debugpy==1.8.1
- decorator==5.1.1
- defusedxml==0.7.1
- docstring-to-markdown==0.15
- exceptiongroup==1.2.0
- executing==2.0.1
- fastjsonschema==2.19.1
- fqdn==1.5.1
- h11==0.14.0
- httpcore==1.0.4
- httpx==0.27.0
- idna==3.6
- ipykernel==6.29.3
- ipython==8.22.2
- isoduration==20.11.0
- jedi==0.17.2
- jinja2==3.1.3
- json5==0.9.20
- jsonpointer==2.4
- jsonschema==4.21.1
- jsonschema-specifications==2023.12.1
- jupyter-client==8.6.0
- jupyter-core==5.7.1
- jupyter-events==0.9.0
- jupyter-lsp==2.2.3
- jupyter-server==2.13.0
- jupyter-server-terminals==0.5.2
- jupyterlab==4.1.2
- jupyterlab-lsp==5.1.0
- jupyterlab-pygments==0.3.0
- jupyterlab-server==2.25.3
- jupyterlab-vim==4.1.3
- markupsafe==2.1.5
- matplotlib-inline==0.1.6
- mistune==3.0.2
- nbclient==0.9.0
- nbconvert==7.16.1
- nbformat==5.9.2
- nest-asyncio==1.6.0
- notebook-shim==0.2.4
- overrides==7.7.0
- packaging==23.2
- pandocfilters==1.5.1
- parso==0.7.1
- platformdirs==4.2.0
- pluggy==1.4.0
- prometheus-client==0.20.0
- prompt-toolkit==3.0.43
- psutil==5.9.8
- pure-eval==0.2.2
- pycparser==2.21
- pygments==2.17.2
- python-dateutil==2.9.0.post0
- python-json-logger==2.0.7
- python-jsonrpc-server==0.4.0
- python-language-server==0.36.2
- python-lsp-jsonrpc==1.1.2
- pywin32==306
- pywinpty==2.0.13
- pyyaml==6.0.1
- pyzmq==25.1.2
- referencing==0.33.0
- requests==2.31.0
- rfc3339-validator==0.1.4
- rfc3986-validator==0.1.1
- rpds-py==0.18.0
- send2trash==1.8.2
- six==1.16.0
- sniffio==1.3.1
- soupsieve==2.5
- stack-data==0.6.3
- terminado==0.18.0
- tinycss2==1.2.1
- tomli==2.0.1
- tornado==6.4
- traitlets==5.14.1
- types-python-dateutil==2.8.19.20240106
- typing-extensions==4.10.0
- ujson==5.9.0
- uri-template==1.3.0
- urllib3==2.2.1
- wcwidth==0.2.13
- webcolors==1.13
- webencodings==0.5.1
- websocket-client==1.7.0
prefix: D:\Yann\miniconda3\envs\GitENV

Command Line Output
[I 2024-03-05 09:50:17.833 ServerApp] jupyter_lsp | extension was successfully linked.
[I 2024-03-05 09:50:17.845 ServerApp] jupyter_server_terminals | extension was successfully linked.
[I 2024-03-05 09:50:17.860 ServerApp] jupyterlab | extension was successfully linked.
[I 2024-03-05 09:50:18.313 ServerApp] notebook_shim | extension was successfully linked.
[I 2024-03-05 09:50:18.353 ServerApp] notebook_shim | extension was successfully loaded.
[I 2024-03-05 09:50:18.356 ServerApp] jupyter_lsp | extension was successfully loaded.
[I 2024-03-05 09:50:18.357 ServerApp] jupyter_server_terminals | extension was successfully loaded.
[I 2024-03-05 09:50:18.363 LabApp] JupyterLab extension loaded from D:\Yann\miniconda3\envs\GitENV\lib\site-packages\jupyterlab
[I 2024-03-05 09:50:18.363 LabApp] JupyterLab application directory is D:\Yann\miniconda3\envs\GitENV\share\jupyter\lab
[I 2024-03-05 09:50:18.364 LabApp] Extension Manager is 'pypi'.
[I 2024-03-05 09:50:18.721 ServerApp] jupyterlab | extension was successfully loaded.
[I 2024-03-05 09:50:18.722 ServerApp] Serving notebooks from local directory: D:\Yann
[I 2024-03-05 09:50:18.722 ServerApp] Jupyter Server 2.13.0 is running at:
[I 2024-03-05 09:50:18.723 ServerApp] http://localhost:8888/lab?token=5e7b45596aff9b76480d35b1da0a299be350c947149dc7e7
[I 2024-03-05 09:50:18.723 ServerApp]     http://127.0.0.1:8888/lab?token=5e7b45596aff9b76480d35b1da0a299be350c947149dc7e7
[I 2024-03-05 09:50:18.724 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 2024-03-05 09:50:18.811 ServerApp]
To access the server, open this file in a browser:
    file:///C:/Users/Administrator/AppData/Roaming/jupyter/runtime/jpserver-15820-open.html
Or copy and paste one of these URLs:
    http://localhost:8888/lab?token=5e7b45596aff9b76480d35b1da0a299be350c947149dc7e7
    http://127.0.0.1:8888/lab?token=5e7b45596aff9b76480d35b1da0a299be350c947149dc7e7

[I 2024-03-05 09:50:20.397 ServerApp] Skipped non-installed server(s): bash-language-server, dockerfile-language-server-nodejs, javascript-typescript-langserver, jedi-language-server, julia-language-server, pyright, python-lsp-server, r-languageserver, sql-language-server, texlab, typescript-language-server, unified-language-server, vscode-css-languageserver-bin, vscode-html-languageserver-bin, vscode-json-languageserver-bin, yaml-language-server
[I 2024-03-05 09:50:21.823 LabApp] Build is up to date
[I 2024-03-05 09:50:37.387 ServerApp] Kernel started: a7aa6faa-8da2-41c8-af31-f4791c40f60e
[I 2024-03-05 09:50:38.481 ServerApp] Connecting to kernel a7aa6faa-8da2-41c8-af31-f4791c40f60e.
[I 2024-03-05 09:50:38.492 ServerApp] Connecting to kernel a7aa6faa-8da2-41c8-af31-f4791c40f60e.
[I 2024-03-05 09:50:38.508 ServerApp] Connecting to kernel a7aa6faa-8da2-41c8-af31-f4791c40f60e.
[E 2024-03-05 09:50:38.559 ServerApp] Uncaught exception GET /lsp/ws/pyls (::1)
HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/lsp/ws/pyls', version='HTTP/1.1', remote_ip='::1')
Traceback (most recent call last):
File "D:\Yann\miniconda3\envs\GitENV\lib\site-packages\tornado\web.py", line 1767, in _execute
result = self.prepare()
File "D:\Yann\miniconda3\envs\GitENV\lib\site-packages\jupyter_server\base\websocket.py", line 121, in prepare
return super().prepare(*args, **kwargs, _redirect_to_login=False)
TypeError: APIHandler.prepare() got an unexpected keyword argument '_redirect_to_login'
[W 2024-03-05 09:50:38.562 ServerApp] wrote error: 'Unhandled error'
Traceback (most recent call last):
File "D:\Yann\miniconda3\envs\GitENV\lib\site-packages\tornado\web.py", line 1767, in _execute
result = self.prepare()
File "D:\Yann\miniconda3\envs\GitENV\lib\site-packages\jupyter_server\base\websocket.py", line 121, in prepare
return super().prepare(*args, **kwargs, _redirect_to_login=False)
TypeError: APIHandler.prepare() got an unexpected keyword argument '_redirect_to_login'
[E 2024-03-05 09:50:38.565 ServerApp] {
"Host": "localhost:8888",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36"
}
[E 2024-03-05 09:50:38.565 ServerApp] 500 GET /lsp/ws/pyls (@::1) 8.01ms referer=None
[W 2024-03-05 09:50:38.567 ServerApp] Got events for closed stream <zmq.eventloop.zmqstream.ZMQStream object at 0x0000021E9CF74970>
[I 2024-03-05 09:56:38.624 ServerApp] Saving file at /Jupyterlab/test.ipynb
[I 2024-03-05 09:57:16.820 ServerApp] Starting buffering for a7aa6faa-8da2-41c8-af31-f4791c40f60e:b3d9964a-1054-4732-8d48-bf3e0147a36e

Browser Output (recommended for all interface issues)
Paste the output from your browser JavaScript console replacing the text in here.

To learn how to open the developer tools in your browser:
https://developer.mozilla.org/en-US/docs/Learn/Common_questions/What_are_browser_developer_tools#How_to_open_the_devtools_in_your_browser
If too many messages accumulated after many hours of working in JupyterLab,
consider refreshing the window and then reproducing the bug to reduce the noise in the logs.

@krassowski
Copy link
Member

For now you can downgrade to jupyter-server 2.12.0 which should temporarily solve the issue. We need to migrate the Websocket handler to work with the new feature in 2.13.0 or patch up jupyter-server - still to be decided.

@frenzymadness
Copy link
Contributor

I have the same problem. I've tried to update jupyter-server in Fedora Linux but now jupyter-lsp fails to build/tests.

@krassowski
Copy link
Member

This should be solved by installing jupyter-lsp 2.2.4. Thanks for the report!

I've tried to update jupyter-server

I was suggesting downgrading, not upgrading ;)

@HMiao-Ian
Copy link
Author

Thanks for your reply, @krassowski, I'll follow your suggestion.

@frenzymadness
Copy link
Contributor

I was suggesting downgrading, not upgrading ;)

I know. I was reporting how I discovered the problem not complaining about the proposed solution :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants