-
Notifications
You must be signed in to change notification settings - Fork 57
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
Using nbclient to talk to jupyter lab running remotely #213
Comments
Hi @amit-chandak-unskript, |
Thanks @davidbrochart, hello @amit-chandak-unskript. Hmm. One of the primary differences between running a kernel via the jupyter-server (lab) REST API and the gateway REST API, is that jupyter-server is session-centric, while the gateway's are more kernel-centric, meaning that all things start from a session in jupyter-server whereas the gateway doesn't. What happens when you use the Might you be able to deploy (and expose) a gateway instance beside your lab instance in EC2? They could both share the same kernel specifications, but have their own managed space (i.e., Lab won't see the Gateway's kernels and vice versa). |
Thanks @kevin-bates @davidbrochart ,
I see the above error, when i am using the jupyterlab server url. Do i need to add some path to the base url? Here is my code snippet
The above script works fine with enterprise gateway. I am just trying the same script with jupyterlab url passed as eg_url argument. |
Its not reachability issue, as i confirmed the jupyterlab server url works if i do the following
|
@kevin-bates i like your idea of having an enterprise gateway beside the jupyterlab server with same kernelspec and use that for nbclient. But i would like to avoid maintaining 2 instances. So, nbclient was never meant to be used with remote jupyterlab server, is it? |
No, it wasn't. Nbclient doesn't talk any HTTP, and jupyter-server is an HTTP server. The only web that it talks is TCP sockets, which are used to connect to a (remote) kernel. If it had access to the kernel's connection info, that would be possible. |
Thanks @davidbrochart , one more question, is it possible to make nbclient use a custom kernel to run? as in does it take a kernel spec to run the notebook? |
Yes, you will need to pass your own kernel manager (km). You can get one like this: from jupyter_client.manager import KernelManager
km = KernelManager(kernel_name="python3")
km.start_kernel()
# pass km to nbclient
km.shutdown_kernel() |
Right, but, as David points out, this won't get you to the remote server. You'd essentially be rewriting |
@amit-chandak-unskript I'm working on a new project that will allow to do just what you want, see davidbrochart/jpterm#2. |
Hi,
I have a use case wherein i have jupyterlab server running on an EC2 instance and i want to run a .ipynb file against a kernel inside that jupyterlab. I was wondering if i can use nbclient to achieve that? I have used nbclient to talk to enterprise gateway and run notebooks but when i try the same approach for standalone jupyterlab server, it doesnt work.
The text was updated successfully, but these errors were encountered: