vscode-jupyter icon indicating copy to clipboard operation
vscode-jupyter copied to clipboard

Support a scratchpad for a jupyter notebook

Open mischki opened this issue 3 years ago • 13 comments

Is there a way to have an interactive command line that is connected to a jupyter notebook? Not a python script divided up into "jupyter cells", which works fine, but a notebook. Running 'Jupyter : Create Interactive Window" creates a shell that doesn't see the variables in Jupyter Notebook's workspace. This functionality was available in plain Jupyter , run in a browser, using the "Scratch Pad" extension. Thanks.

mischki avatar Jul 01 '21 15:07 mischki

Thanks for the suggestion, I know that we've batted around the idea of a scratchpad extension a few times for VS Code. We'll put it in for consideration. Personally I think it would be an excellent addition.

IanMatthewHuff avatar Jul 01 '21 20:07 IanMatthewHuff

Thank you. Are you aware of any workarounds?

mischki avatar Jul 01 '21 21:07 mischki

Thank you. Are you aware of any workarounds?

Hi @mischki have you found any workarounds in the meantime :)? Really slows down my trial–and-error development process I became so used to when using the VSCode python debugger.

Cheers, Phil

philffm avatar Dec 17 '21 17:12 philffm

Thank you. Are you aware of any workarounds?

Hi @mischki have you found any workarounds in the meantime :)? Really slows down my trial–and-error development process I became so used to when using the VSCode python debugger.

Cheers, Phil

Hi Phil, I'm still using Jupyter in Chrome and anxiously googling about this every week. There seems to be no interest among the developers.

mischki avatar Dec 17 '21 18:12 mischki

@mischki

Cheers! Seems like I managed to got it working. (can use the Jupyter Notebook variables in the interactive window now. A bit of a process but imho worth it :D)

The process

  1. Command + Shift + P
  2. Jupyter: Create Interactive Window
  3. Copy URL of Remote Jupyter Session
  4. again: Command + Shift + P -> Jupyter: Specify local or remote Jupyter server for connections
  5. Paste URL of Remote Jupyter Session
  6. In the interactive window select the current session (remote)
  7. That's it! The active variables from the Jupyter Notebook should now available in the interactive console

philffm avatar Jan 21 '22 16:01 philffm

Hi. Is your Jupyter Notebook opened within VSCode or in a browser? If in VSCode, how do you copy its url? Thanks.

mischki avatar Jan 22 '22 17:01 mischki

@mischki haha, that's a bit tricky indeed: I copy the entire block, paste it in the execution field and from there I can easily copy the URL (no need to touch the browser, everything in VSCode)

Screenshot 2022-01-22 at 18 13 05 Screenshot 2022-01-22 at 18 13 37

philffm avatar Jan 22 '22 17:01 philffm

Sorry, I'm quite new to VSCode. How do you get to that window (first picture) from where you copy the URL? When I open a Jupyter notebook in VSCode I don't see a window with a URL like that. Thanks.

mischki avatar Jan 22 '22 17:01 mischki

image

This one gets you to the interactive window. (Command - Shift - P (guess something similar when you're using Windows / Linux)) Hope that helps :)

philffm avatar Jan 23 '22 09:01 philffm

I meant this one image

mischki avatar Jan 23 '22 16:01 mischki

I meant this one image

When I start a Jupyter Interactive Window this is what I get image No URL anywhere. So I still don't know how to get the URL of the Notebook's kernel to paste into the interactive window. What am I missing? Thanks

mischki avatar Jan 24 '22 20:01 mischki

Yes, I'm also really missing the console in Jupyterlab. Here's a related vscode request too: #100061

notuntoward avatar Feb 05 '22 20:02 notuntoward

@mischki Now it also happened to me - there was no URL shown anymore in the March 2022 version of VSCode - so I downgraded to the Feb version and it started working again 🤷🏽‍♂️

philffm avatar Apr 06 '22 17:04 philffm

@mischki Now it also happened to me - there was no URL shown anymore in the March 2022 version of VSCode - so I downgraded to the Feb version and it started working again 🤷🏽‍♂️

I tested the approach using terminal and typing: jupyter notebook as suggested here. I can confirm that this works as well and there is no need to downgrade or change VS Code versions.

The process is similar:

  1. Open terminal and type jupyter notebook in terminal and copy localhost (it will also open Jupyter in browser by default but you don't need to keep running it).
  2. Command + Shift + P
  3. Specify Jupyter Server for Connections
  4. Paste copied URL
  5. Command + Shift + P
  6. Open interactive window and select the remote kernel you specified earlier
  7. Select the same remote kernel also in your Jupyter session, i.e. local notebook so identical kernel is in interactive and local session. Now you should have output carried from your Jupyter notebook to your interactive window.

martincadek avatar Sep 05 '22 10:09 martincadek

duplicate of https://github.com/microsoft/vscode-jupyter/issues/4573

amunger avatar Dec 06 '22 18:12 amunger