Skip to content
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

Test: Run By Line in Jupyter notebooks #129467

Closed
3 tasks done
roblourens opened this issue Jul 26, 2021 · 15 comments
Closed
3 tasks done

Test: Run By Line in Jupyter notebooks #129467

roblourens opened this issue Jul 26, 2021 · 15 comments

Comments

@roblourens
Copy link
Member

roblourens commented Jul 26, 2021

Refs: #126431, #128582

Complexity: 3

Authors: @roblourens, @DavidKutu

Create Issue


  • Install ipykernel 6 or newer, which has debugging support
pip install ipykernel
python3 -m ipykernel install --user
or
pip install ipykernel --upgrade
  • Make sure you have the latest version of the Jupyter extension installed in VS Code Insiders

  • Set the experiment setting to enable Run by Line "jupyter.experimental.debugging": true

  • Open a .ipynb notebook file

  • Pick a kernel, make sure you pick the one where you installed ipykernel 6

  • Click the Run by Line button in the cell toolbar

image

The button takes a bit to appear, as it's checking that you have ipykernel 6

  • A debugging session should start, without the status bar changing, without the debug widget and without revealing the debug sidebar automatically
  • Press the same button to advance to the next line, or the stop button to end the session
  • Once you've stepped to the end of the cell, you have to press the stop button in the cell toolbar

More testing

  • It should not step into another cell or file
  • Note: the flow above is the only entrypoint. launch.json is not relevant here.
  • Test run by line in an untitled notebook
  • You should never see an error that looks something like "Unable to open ..." with some tmp file path
  • Test run by line in two notebooks simultaneously

Known issues

  • The run by line button takes a second to appear on notebook with valid kernels, it will be cached for the final release.
  • The jupyter variables view is not enabled yet.
  • There are two stop buttons visible (the normal cancel button and the RBL stop button in the cell toolbar) but these will be merged
@sandy081
Copy link
Member

@roblourens I do not see Run by Line button in the cell toolbar. I installed ipykernel as you mentioned in the instruction. Is there a way to check if I have done correctly? This is what I see

image

@bamurtaugh
Copy link
Member

I also do not see Run by Line:

image

I am on Jupyter extension v2021.8.1070546638

@miguelsolorio
Copy link
Contributor

Installing ipykernel only installs v.5.3.4 for me and there doesn't appear an option install v6 via Anaconda Navigator?

CleanShot 2021-07-27 at 12 38 58@2x

CleanShot 2021-07-27 at 12 41 30@2x

@miguelsolorio
Copy link
Contributor

Ok, I was able to upgrade via pip install ipykernel --upgrade, I assumed that installing ipykernel would install the newest version.

@bamurtaugh
Copy link
Member

Another question - I needed to update my ipykernel version (as Miguel mentioned), but now that I've done that, should run by line work in a WSL environment?

Before I jump to spinning up a Linux VM, wanted to understand if this was a limitation of WSL, an issue with the actual notebook/run by line, or something else (I usually test Windows or anyOS items so wasn't sure if it was expected WSL may not work).

image

@roblourens
Copy link
Member Author

roblourens commented Jul 27, 2021

Sorry for not being more clear about ipykernel. And I don't know why it wouldn't work in WSL. Did the notebook find your kernel, and were you able to select the right one?

@bamurtaugh
Copy link
Member

Yes, I ended up installed Python 3.8 and Python 3.9, and it found both versions. I was able to select each one:

image

@roblourens
Copy link
Member Author

And you can execute cells with it, and that's the one that you ran when installing ipykernel?

@bamurtaugh
Copy link
Member

Yes it's letting me run cells:

image

and that's the one that you ran when installing ipykernel

I was checking jupyter --version to check on my version of ipykernel, but realized it has the same output regardless of which kernel I have selected.

I'm also unsure what I should be seeing in the status bar. I'm used to seeing the Python version of the interpreter, but now it's gone:

image

I tried creating a virtual environment. Initially, it defaulted to Python 3.6.9, so I manually changed it to 3.9.6, and now the status bar reads "Python 3.9.6":

image

However, when I close the virtual env file, the status bar entry disappears:

image

Apologies if these are obvious setup questions - I haven't experienced these issues when running regular Python projects in WSL before, and for more complex setups, I usually use dev containers. But when I tried the notebook in a dev container in WSL, I also still didn't see the run by line.

@roblourens
Copy link
Member Author

I use a virtual env and I recommend that, but it looks like the venv isn't active in your terminal and isn't selected in the notebook.

I had better instructions on setting up a venv for debugging in last month's test plan item, I should have posted these again

#127362

@bamurtaugh
Copy link
Member

Thanks for the links. I created an Azure VM and was just about to give up on WSL and use a VM with a venv for now until I realized the setting was grayed out:

image

I needed to enabled it explicitly for the WSL or SSH remote (rather than just putting it in my local settings.json). Once I did that in WSL, I see run by line:

image

(surprised it took me this long to realize this mistake 😅)

Now on to actual testing!

@roblourens
Copy link
Member Author

Oh, that setting should not be machine scoped, I don't know why it is. I'll file an issue. Sorry for the trouble!

@sandy081
Copy link
Member

@roblourens Please let me know if I am doing some thing wrong. I have install ipykernel version 6.0.3 and enabled the setting jupyter.experimental.debugging and I still do not see the Run By Line action.

image

I am blocked on this to test.

@roblourens
Copy link
Member Author

Sorry @sandy081, I think there is a problem with Conda. Thanks for taking it @alexr00

@weinand
Copy link
Contributor

weinand commented Jul 29, 2021

@roblourens just a meta-comment: preparing a Dockerfile for these complex setups is helpful. For my simple-jupyter-notebook I did just that: https://github.com/microsoft/vscode-simple-jupyter-notebook#running-sample-in-docker-container
After installing Conda on my productive OS I saw all kinds of issues...

@github-actions github-actions bot locked and limited conversation to collaborators Sep 12, 2021
@TylerLeonhardt TylerLeonhardt added verified Verification succeeded and removed verified Verification succeeded labels Oct 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants