microsoft / vscode-jupyter

VS Code Jupyter extension
https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter
MIT License
1.3k stars 294 forks source link

Problems in querying remote kernel picker #16163

Closed realDuang closed 3 weeks ago

realDuang commented 3 weeks ago

Applies To

What happened?

We have registered a custom server collection to proxy all the jupyter requests.

When jupyter tries to call jupyterApi/versions/1/api/kernelspecs, we set the return like this:

kernelspecs: {
        python310: {
          name: 'jupyter',
          spec: {
            language: 'Python',
            argv: [],
            display_name: 'Python 3.10',
            codemirror_mode: null,
            env: null,
            help_links: null,
            metadata: {
              debugger: true,
              runtime_version: JupyterRuntimeKernel.python310
            }
          },
          resources: {}
        },
        python311: {
          name: 'jupyter',
          spec: {
            language: 'Python',
            argv: [],
            display_name: 'Python 3.11',
            codemirror_mode: null,
            env: null,
            help_links: null,
            metadata: {
              debugger: true,
              runtime_version: JupyterRuntimeKernel.python311
            }
          },
          resources: {}
        }
}

But when i open the switch kernel picker, it only shows one result:

Image

VS Code Version

1.94

Jupyter Extension Version

v2024.9.1

Jupyter logs

No response

Coding Language and Runtime Version

No response

Language Extension Version (if applicable)

No response

Anaconda Version (if applicable)

No response

Running Jupyter locally or remotely?

Remote

realDuang commented 3 weeks ago

I'm guessing this might be a key value conflict due to the fact that the kernel picker is traversing the name in the kernelspec. Should it use the object key of the kernelspec as the key for the list, so that all the lists in kernelspec request can be displayed?

DonJayamanne commented 3 weeks ago

Name must be the same as the object key vbalue. This is what it must return

kernelspecs: {
        python310: {
          name: 'python310',
          spec: {
            language: 'Python',
            argv: [],
            display_name: 'Python 3.10',
            codemirror_mode: null,
            env: null,
            help_links: null,
            metadata: {
              debugger: true,
              runtime_version: JupyterRuntimeKernel.python310
            }
          },
          resources: {}
        },
        python311: {
          name: 'python311',
          spec: {
            language: 'Python',
            argv: [],
            display_name: 'Python 3.11',
            codemirror_mode: null,
            env: null,
            help_links: null,
            metadata: {
              debugger: true,
              runtime_version: JupyterRuntimeKernel.python311
            }
          },
          resources: {}
        }
}
DonJayamanne commented 3 weeks ago

I'm include not to change anything in Jupyter extension, as this is how jupyter lab/notebook work today, i.e. thats the format of the data returned. I would suggest changing this at your end. Closing as the data returned is invalid, changing as suggested should fix this.