jupyter-server / jupyverse

A Jupyter server based on FastAPI :rocket:
https://jupyter-server.github.io/jupyverse
Other
228 stars 27 forks source link

VS Code cannot connect to jupyverse #392

Open Atry opened 5 months ago

Atry commented 5 months ago

Description

I got the following error when trying to connect to jupyverse from VSCode

Connection failure. Verify the server is running and reachable. (invalid json response body at http://127.0.0.1:8000/login reason: Unexpected token < in JSON at position 0).

Reproduce

Step 1: Install jupyverse

pip install jupyverse[auth,jupyterlab]==0.4.2

Step2: Start jupyverse

$ jupyverse
[2024-03-31 20:49:55,408 INFO] Running in development mode
[2024-03-31 20:49:55,420 INFO] Starting application
[2024-03-31 20:49:56,247 INFO] 
[2024-03-31 20:49:56,247 INFO] To access the server, copy and paste this URL:
[2024-03-31 20:49:56,248 INFO] http://127.0.0.1:8000/?token=7b91e9c1fa1244768a041a6b175c53b9
[2024-03-31 20:49:56,248 INFO] 
[2024-03-31 20:49:56,257 INFO] Started server process [35886]
[2024-03-31 20:49:56,257 INFO] Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
[2024-03-31 20:49:56,257 INFO] Application started

Step 3:

In VSCode, try to connect to http://127.0.0.1:8000/?token=7b91e9c1fa1244768a041a6b175c53b9, according to https://code.visualstudio.com/docs/datascience/notebooks-web#_connect-to-a-remote-jupyter-server

Result

Connection failure. Verify the server is running and reachable. (invalid json response body at http://127.0.0.1:8000/login reason: Unexpected token < in JSON at position 0).

image

Expected behavior

No error

Context

Troubleshoot Output
$PATH:
        /home/nixos/demo/.venv/bin
        /nix/store/3dkwsqszwx8wrqf7srj8gkvxhzfq6pci-devenv-profile/bin
        /home/nixos/peftai/.direnv/bin
        /home/nixos/.vscode-server/bin/863d2581ecda6849923a2118d93a088b0745d9d6/bin/remote-cli
        /run/wrappers/bin
        /usr/local/sbin
        /usr/local/bin
        /usr/sbin
        /usr/bin
        /sbin
        /bin
        /usr/games
        /usr/local/games
        /usr/lib/wsl/lib
        /home/nixos/.nix-profile/bin
        /nix/profile/bin
        /home/nixos/.local/state/nix/profile/bin
        /etc/profiles/per-user/nixos/bin
        /nix/var/nix/profiles/default/bin
        /run/current-system/sw/bin
        /mnt/c/Program Files/WindowsApps/MicrosoftCorporationII.WindowsSubsystemForLinux_2.1.5.0_x64__8wekyb3d8bbwe
        /mnt/c/Program Files/Microsoft MPI/Bin/
        /mnt/c/Python312/Scripts/
        /mnt/c/Python312/
        /mnt/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.2/bin
        /mnt/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.2/libnvvp
        /mnt/c/Python311/Scripts/
        /mnt/c/Python311/
        /mnt/c/Program Files (x86)/Common Files/Oracle/Java/javapath
        /mnt/c/Program Files/ImageMagick-7.1.1-Q16-HDRI
        /mnt/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.0/bin
        /mnt/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.0/libnvvp
        /mnt/c/Python310/Scripts/
        /mnt/c/Python310/
        /mnt/c/Windows/system32
        /mnt/c/Windows
        /mnt/c/Windows/System32/Wbem
        /mnt/c/Windows/System32/WindowsPowerShell/v1.0/
        /mnt/c/Windows/System32/OpenSSH/
        /mnt/c/ProgramData/chocolatey/bin
        /mnt/c/Program Files/Microsoft VS Code/bin
        /mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common
        /mnt/c/Program Files/dotnet/
        /mnt/c/ProgramData/nvm
        /mnt/c/Program Files/nodejs
        /mnt/c/tools/gsudo/Current
        /mnt/c/Program Files (x86)/Nodist/bin
        /mnt/c/Program Files/Java/jdk1.8.0_211/bin
        /mnt/c/ProgramData/chocolatey/lib/mpv.install/tools
        /mnt/c/Program Files/Kubernetes/Minikube
        /mnt/c/WINDOWS/system32
        /mnt/c/WINDOWS
        /mnt/c/WINDOWS/System32/Wbem
        /mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/
        /mnt/c/WINDOWS/System32/OpenSSH/
        /mnt/c/Program Files/gs/gs10.00.0/bin
        /mnt/c/Program Files (x86)/PDFtk/bin/
        /mnt/c/Program Files/NVIDIA Corporation/NVIDIA NvDLISR
        /mnt/c/Program Files/NVIDIA Corporation/Nsight Compute 2023.2.0/
        /mnt/c/Program Files/Git/cmd
        /mnt/c/ProgramData/nvm
        /mnt/c/Program Files/nodejs
        /mnt/c/Program Files/OpenJDK/jdk-21.0.1/bin
        /mnt/c/Program Files (x86)/sbt/bin
        /mnt/c/Program Files/GitHub CLI/
        /mnt/e/ChatWithRTX/env_nvd_rag/Lib/site-packages/torch/lib
        /mnt/c/Program Files/Docker/Docker/resources/bin
        /mnt/c/Users/atry/AppData/Local/Programs/Python/Launcher/
        /mnt/c/Users/atry/AppData/Local/Programs/Python/Python310/Scripts/
        /mnt/c/Users/atry/AppData/Local/Programs/Python/Python310/
        /mnt/c/Users/atry/scoop/shims
        /mnt/c/Users/atry/AppData/Local/Microsoft/WindowsApps
        /mnt/c/ProgramData/nvm
        /mnt/c/Program Files/nodejs
        /mnt/c/ProgramData/chocolatey/lib/psutils/tools/psutils-master/
        /mnt/c/Users/atry/AppData/Roaming/Python/Scripts
        /mnt/c/Users/atry/AppData/Local/Microsoft/WindowsApps
        /mnt/c/ProgramData/nvm
        /mnt/c/Program Files/nodejs
        /nix/store/klc3y2c97sc22wsv1cjwf4dfwcws095l-systemd-255.2/bin
        /nix/store/320v66ili0mwnyrxj3dwbxm0z8ndkbw7-gnugrep-3.11/bin
        /nix/store/klc3y2c97sc22wsv1cjwf4dfwcws095l-systemd-255.2/bin
        /nix/store/320v66ili0mwnyrxj3dwbxm0z8ndkbw7-gnugrep-3.11/bin

sys.path:
        /home/nixos/peftai/.venv/bin
        /nix/store/3dkwsqszwx8wrqf7srj8gkvxhzfq6pci-devenv-profile/lib/python3.11/site-packages
        /nix/store/7wz6hm9i8wljz0hgwz1wqmn2zlbgavrq-python3-3.11.8/lib/python311.zip
        /nix/store/7wz6hm9i8wljz0hgwz1wqmn2zlbgavrq-python3-3.11.8/lib/python3.11
        /nix/store/7wz6hm9i8wljz0hgwz1wqmn2zlbgavrq-python3-3.11.8/lib/python3.11/lib-dynload
        /home/nixos/demo/.venv/lib/python3.11/site-packages
        /home/nixos/peftai/lib/absurd/src
        /home/nixos/peftai/lib/auto-dataclass/src
        /home/nixos/peftai/lib/auto-extend/src
        /home/nixos/peftai/lib/dunder-mixin/src
        /home/nixos/peftai/lib/mro/src
        /home/nixos/peftai/src
        /home/nixos/peftai/lib/picklable-singleton/src
        /home/nixos/peftai/lib/resolved-property/src
        /home/nixos/peftai/lib/run-module/src

sys.executable:
        /home/nixos/demo/.venv/bin/python

sys.version:
        3.11.8 (main, Feb  6 2024, 21:21:21) [GCC 13.2.0]

platform.platform():
        Linux-5.15.146.1-microsoft-standard-WSL2-x86_64-with-glibc2.38

which -a jupyter:
        /home/nixos/demo/.venv/bin/jupyter

pip list:
        Package                     Version        Editable project location
        --------------------------- -------------- ------------------------------------------
        absurd                      1.0.0          /home/nixos/peftai/lib/absurd
        accelerate                  0.23.0
        aiofiles                    23.2.1
        aiohttp                     3.8.6
        aiosignal                   1.3.1
        aiosqlite                   0.20.0
        annotated-types             0.6.0
        anyio                       4.3.0
        argon2-cffi                 23.1.0
        argon2-cffi-bindings        21.2.0
        arrow                       1.3.0
        asgiref                     3.8.1
        asphalt                     4.12.0
        asphalt-web                 1.3.1
        asttokens                   2.4.0
        async-generator             1.10
        async-lru                   2.0.4
        async-timeout               4.0.3
        asyncio-extras              1.3.2
        asyncstdlib                 3.10.9
        attrs                       23.1.0
        auto-dataclass              1.0.0          /home/nixos/peftai/lib/auto-dataclass
        auto-extend                 1.0.0          /home/nixos/peftai/lib/auto-extend
        autoawq                     0.2.4
        autoawq_kernels             0.0.6
        autoflake                   2.2.1
        autoimport                  1.4.0
        azure-cli                   2.58.0
        Babel                       2.14.0
        backcall                    0.2.0
        bcrypt                      4.1.2
        beautifulsoup4              4.12.2
        bitsandbytes                0.43.0
        black                       24.3.0
        bleach                      6.1.0
        cached_classproperty        1.0.1
        cachetools                  5.3.1
        certifi                     2023.7.22
        cffi                        1.16.0
        charset-normalizer          3.3.0
        click                       8.1.7
        cloudpickle                 3.0.0
        comm                        0.1.4
        cryptography                41.0.4
        cupy-cuda12x                12.1.0
        datasets                    2.18.0
        debugpy                     1.8.0
        decorator                   5.1.1
        deepmerge                   1.1.0
        defusedxml                  0.7.1
        dill                        0.3.8
        diskcache                   5.6.3
        dnspython                   2.6.1
        docstring-to-markdown       0.15
        dunder-mixin                1.0.0          /home/nixos/peftai/lib/dunder-mixin
        ecdsa                       0.18.0
        einops                      0.7.0
        email_validator             2.1.1
        executing                   2.0.0
        fastapi                     0.110.0
        fastapi-users               12.1.3
        fastapi-users-db-sqlalchemy 6.0.1
        fastjsonschema              2.18.1
        fastrlock                   0.8.2
        filelock                    3.12.4
        flash-attn                  2.5.6
        fps_auth                    0.4.2
        fps_contents                0.4.2
        fps_frontend                0.4.2
        fps_jupyterlab              0.4.2
        fps_kernels                 0.4.2
        fps_lab                     0.4.2
        fps_login                   0.4.2
        fps_nbconvert               0.4.2
        fps_terminals               0.4.2
        fps_yjs                     0.4.2
        fqdn                        1.5.1
        frozenlist                  1.4.0
        fsspec                      2023.9.2
        gptcache                    0.1.42
        greenlet                    3.0.3
        guidance                    0.0.64
        h11                         0.14.0
        hiredis                     2.2.3
        httpcore                    1.0.5
        httptools                   0.6.1
        httpx                       0.26.0
        httpx-oauth                 0.13.2
        huggingface-hub             0.19.4
        idna                        3.4
        immutables                  0.20
        interegular                 0.3.3
        ipykernel                   6.25.2
        ipython                     8.16.1
        ipywidgets                  8.1.2
        isoduration                 20.11.0
        isort                       5.13.2
        jaraco.functools            3.9.0
        jedi                        0.19.1
        Jinja2                      3.1.2
        joblib                      1.3.2
        json5                       0.9.24
        jsonpointer                 2.4
        jsonschema                  4.19.1
        jsonschema-specifications   2023.7.1
        jupyter                     1.0.0
        jupyter_client              8.4.0
        jupyter-console             6.6.3
        jupyter_core                5.4.0
        jupyter-events              0.10.0
        jupyter-kernel-gateway      3.0.1
        jupyter-lsp                 2.2.4
        jupyter_server              2.13.0
        jupyter_server_terminals    0.5.3
        jupyterlab                  4.1.5
        jupyterlab-pygments         0.2.2
        jupyterlab_server           2.25.4
        jupyterlab_widgets          3.0.10
        jupyverse                   0.4.2
        jupyverse_api               0.4.2
        lark                        1.1.9
        llvmlite                    0.42.0
        maison                      1.4.3
        makefun                     1.15.2
        markdown-it-py              3.0.0
        MarkupSafe                  2.1.3
        matplotlib-inline           0.1.6
        mdurl                       0.1.2
        mistune                     3.0.2
        more-itertools              9.1.0
        mpmath                      1.3.0
        mro                         1.0.0          /home/nixos/peftai/lib/mro
        msal                        1.24.1
        msgpack                     1.0.8
        multidict                   6.0.4
        multiprocess                0.70.16
        mypy-extensions             1.0.0
        nbclient                    0.8.0
        nbconvert                   7.9.2
        nbformat                    5.9.2
        nest-asyncio                1.5.8
        networkx                    3.1
        ninja                       1.11.1.1
        nodeenv                     1.8.0
        notebook                    7.1.2
        notebook_shim               0.2.4
        numba                       0.59.1
        numpy                       1.26.0
        nvidia-cublas-cu12          12.1.3.1
        nvidia-cuda-cupti-cu12      12.1.105
        nvidia-cuda-nvrtc-cu12      12.1.105
        nvidia-cuda-runtime-cu12    12.1.105
        nvidia-cudnn-cu12           8.9.2.26
        nvidia-cufft-cu12           11.0.2.54
        nvidia-curand-cu12          10.3.2.106
        nvidia-cusolver-cu12        11.4.5.107
        nvidia-cusparse-cu12        12.1.0.106
        nvidia-nccl-cu12            2.18.1
        nvidia-nvjitlink-cu12       12.4.99
        nvidia-nvtx-cu12            12.1.105
        openai                      0.28.1
        outlines                    0.0.37
        overrides                   7.7.0
        packaging                   23.2
        pandas                      2.2.1
        pandocfilters               1.5.0
        parso                       0.8.3
        passlib                     1.7.4
        pathspec                    0.12.1
        peft                        0.5.0
        peftai                      1.0.0          /home/nixos/peftai
        pexpect                     4.8.0
        picklable-singleton         1.0.0          /home/nixos/peftai/lib/picklable-singleton
        pickleshare                 0.7.5
        pip                         24.0
        platformdirs                3.11.0
        pluggy                      1.4.0
        poetry                      1.8.2
        prometheus_client           0.20.0
        prompt-toolkit              3.0.39
        protobuf                    5.26.0
        psutil                      5.9.5
        ptyprocess                  0.7.0
        pure-eval                   0.2.2
        py-cord                     2.4.1
        pyarrow                     15.0.2
        pyarrow-hotfix              0.6
        pyasn1                      0.5.0
        pycparser                   2.21
        pycrdt                      0.8.17
        pydantic                    2.0.3
        pydantic_core               2.3.0
        pyflakes                    3.1.0
        Pygments                    2.16.1
        pygtrie                     2.5.0
        PyJWT                       2.8.0
        pynvml                      11.5.0
        pyparsing                   3.1.1
        pyprojroot                  0.3.0
        pyright                     1.1.331
        PySide6                     6.6.3
        PySide6_Addons              6.6.3
        PySide6_Essentials          6.6.3
        python-dateutil             2.8.2
        python-dotenv               1.0.1
        python-jose                 3.3.0
        python-json-logger          2.0.7
        python-jsonrpc-server       0.4.0
        python-language-server      0.36.2
        python-lsp-jsonrpc          1.1.2
        python-lsp-server           1.11.0
        python-multipart            0.0.7
        python-ulid                 1.1.0
        pytz                        2024.1
        pyxll                       5.8.0
        pyxll_jupyter               0.5.2
        PyYAML                      6.0.1
        pyzmq                       25.1.1
        qtconsole                   5.5.1
        QtPy                        2.4.1
        ray                         2.10.0
        redis                       4.6.0
        redis-om                    0.2.1
        referencing                 0.30.2
        regex                       2023.10.3
        remixin                     1.0.0          /home/nixos/peftai/lib/remixin
        requests                    2.31.0
        resolved-property           1.0.0          /home/nixos/peftai/lib/resolved-property
        rfc3339-validator           0.1.4
        rfc3986-validator           0.1.1
        rich                        13.7.1
        rich-click                  1.7.4
        rpds-py                     0.10.6
        rsa                         4.9
        ruamel.yaml                 0.18.6
        ruamel.yaml.clib            0.2.8
        run-module                  1.0.0          /home/nixos/peftai/lib/run-module
        safetensors                 0.4.2
        scipy                       1.11.3
        Send2Trash                  1.8.2
        sentencepiece               0.2.0
        setuptools                  69.2.0
        sh                          2.0.6
        shiboken6                   6.6.3
        six                         1.16.0
        sniffio                     1.3.1
        soupsieve                   2.5
        SQLAlchemy                  2.0.29
        stack-data                  0.6.3
        starlette                   0.36.3
        sympy                       1.12
        terminado                   0.18.1
        tiktoken                    0.5.1
        tinycss2                    1.2.1
        tokenizers                  0.15.0
        toml                        0.10.2
        torch                       2.1.2
        tornado                     6.3.3
        tqdm                        4.66.1
        traitlets                   5.11.2
        transformers                4.38.2
        triton                      2.1.0
        typeguard                   4.1.5
        types-pyOpenSSL             23.2.0.2
        types-python-dateutil       2.9.0.20240316
        types-redis                 4.6.0.7
        typing_extensions           4.8.0
        tzdata                      2024.1
        ujson                       5.9.0
        uri-template                1.3.0
        urllib3                     2.0.6
        uvicorn                     0.29.0
        uvloop                      0.19.0
        vllm                        0.3.3
        vulnix                      1.10.1
        watchfiles                  0.21.0
        wcwidth                     0.2.8
        webcolors                   1.13
        webencodings                0.5.1
        websocket-client            1.7.0
        websockets                  12.0
        widgetsnbextension          4.0.10
        xdg                         6.0.0
        xformers                    0.0.23.post1
        xxhash                      3.4.1
        yarl                        1.9.2
        zstandard                   0.22.0
Command Line Output
$ jupyverse
[2024-03-31 20:59:50,386 INFO] Running in development mode
[2024-03-31 20:59:50,399 INFO] Starting application
[2024-03-31 20:59:51,223 INFO] 
[2024-03-31 20:59:51,224 INFO] To access the server, copy and paste this URL:
[2024-03-31 20:59:51,224 INFO] http://127.0.0.1:8000/?token=9a8c8f6032f843e0bd1e1769f8f0578c
[2024-03-31 20:59:51,224 INFO] 
[2024-03-31 20:59:51,231 INFO] Started server process [38398]
[2024-03-31 20:59:51,231 INFO] Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
[2024-03-31 20:59:51,231 INFO] Application started
[2024-03-31 21:00:18,920 INFO] 127.0.0.1:54144 - "GET /hub/api HTTP/1.1" 404
[2024-03-31 21:00:19,974 INFO] 127.0.0.1:54154 - "GET /tree HTTP/1.1" 404
[2024-03-31 21:00:21,038 INFO] 127.0.0.1:54182 - "GET /api/kernels?1711918820006 HTTP/1.1" 307
[2024-03-31 21:00:21,040 INFO] 127.0.0.1:54162 - "GET /api/kernelspecs?1711918820004 HTTP/1.1" 307
[2024-03-31 21:00:21,042 INFO] 127.0.0.1:54174 - "GET /api/kernels?1711918820005 HTTP/1.1" 307
[2024-03-31 21:00:21,042 INFO] 127.0.0.1:54194 - "GET /api/sessions?1711918820006 HTTP/1.1" 307
[2024-03-31 21:00:22,086 INFO] 127.0.0.1:54198 - "GET /login HTTP/1.1" 200
[2024-03-31 21:00:22,086 INFO] 127.0.0.1:54212 - "GET /login HTTP/1.1" 200
[2024-03-31 21:00:22,087 INFO] 127.0.0.1:54218 - "GET /login HTTP/1.1" 200
[2024-03-31 21:00:22,087 INFO] 127.0.0.1:54232 - "GET /login HTTP/1.1" 200

Client Output
21:00:19.971 [error] Jupyter Lab Helper:getKernelSpecs failure:  Error: Poll (@jupyterlab/services:KernelSpecManager#specs) is disposed.
    at v.dispose (~/.vscode-server/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:10935)
    at ni.dispose (~/.vscode-server/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:29299)
    at r.dispose (~/.vscode-server/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:198:12579)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Promise.all (index 0)
    at sD.listKernelsFromConnection (~/.vscode-server/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:20060)
    at ~/.vscode-server/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:17959
21:00:20.003 [warn] Password for http://127.0.0.1:8000/ was invalid.

welcome[bot] commented 5 months ago

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively. welcome You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada: