Open zhenxxxx opened 1 year ago
You can configure the kernel name and server via props on the Jupyter context as listed on https://jupyter-ui.datalayer.tech/docs/components/context/
defaultKernelName
jupyterServerHttpUrl
jupyterServerWsUrl
Doe it help? If you want to assign/change kernels, you can have a look at this example https://github.com/datalayer/jupyter-ui/blob/main/packages/react/src/examples/NotebookKernelChange.tsx
Thanks for your reply, how do I get all the kernels from the jupyter server, e.g. which api should I use?? I've seen examples, how does it determine which kernel to use, is it by specifying a kernel name?
You can list the available kernelspecs with
$ jupyter kernelspec list
Available kernels:
python3 .../jupyter/kernels/python3
python3-slow-start .../jupyter/kernels/python3-slow-start
python3
or python3-slow-start
will be the names you would use for the defaultKernelName
.
Thanks, I will try it.
I use the defaultKernelName to select the kernel, but this doesn't seem to work, it's always use default kernel.
if (kernelManager) {
const kernel = new Kernel({
kernelManager,
kernelName: "python38_test",
kernelType: "notebook",
kernelSpecName: "python",
serverSettings,
});
kernel.ready.then(() => {
dispatch(notebookActions.changeKernel({ uid: NOTEBOOK_UID, kernel }));
alert('The kernel is changed.')
});
}
@alwayslovez Right, there was an issue which I have fixed in the 0.7.7
release. You will have to set the kernelSpecName
to the name the command jupyter kernelspec list
returns. So this would be:
if (kernelManager) {
const kernel = new Kernel({
kernelManager,
kernelName: "python38_test",
kernelType: "notebook",
kernelSpecName: "python",
serverSettings,
});
kernel.ready.then(() => {
dispatch(notebookActions.changeKernel({ uid: NOTEBOOK_UID, kernel }));
alert('The kernel is changed.')
});
}
PS: Your screenshot is showing pyrhon38_test
- is that a typo ? it should be python38_test
(with a t, not a r)
For example, there is a menu that contains all kernel get from jupyter server. And I can select the different kernels in this menu.
Working on that ATM with https://github.com/datalayer/jupyter-ui/issues/123
Problem
I just want to know if there is a way to select the kernel in the jupyter server? For example, there is a menu that contains all kernel get from jupyter server. And I can select the different kernels in this menu.
And there is a way to set a remote jupyter server in UI?