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: Debug Cell in Jupyter notebooks #133905

Closed
3 tasks done
DavidKutu opened this issue Sep 27, 2021 · 4 comments
Closed
3 tasks done

Test: Debug Cell in Jupyter notebooks #133905

DavidKutu opened this issue Sep 27, 2021 · 4 comments

Comments

@DavidKutu
Copy link

DavidKutu commented Sep 27, 2021

Refs: microsoft/vscode-jupyter#1652

Complexity: 3

Authors: @roblourens, @DavidKutu

Create Issue

Create Issue


Setup

  • Use VS Code Insiders and the latest jupyter and python extensions
  • Make sure that you have python 3.7 or greater installed and on your path as python3 or python
  • Set up a python virtualenv:
mkdir jupyter-dbg
cd jupyter-dbg
python3 -m venv ipykernel-env
  • Activate the virtual environment

Mac/Linux:

source ipykernel-env/bin/activate

Windows:

ipykernel-env\Scripts\activate.bat
  • Install the latest version of ipykernel in the virtual environment, which has debugging support
pip install ipykernel --pre
python3 -m ipykernel install --user
  • Open a .ipynb notebook file (You can use this one if you need one)
  • Pick the kernel from your virtual env
  • Set "jupyter.logging.level": "verbose"

Testing

  • Set a breakpoint on the cell you want to test
  • Click Debug Cell under the Run button, you should hit the breakpoint and start a normal debugging session
    image
  • Try stepping into other cells, other python files, and other python packages as usual
  • Finishing the cell should stop debugging
  • Interrupting or Restarting the kernel should also stop Debugging
  • While debugging, the run by line button should be disabled
  • You should never get a temp file opened that reads: Could not load source ...

More Testing

  • Check on the panel, that Jupyter: Variables gets updated after each step

Filing issues

File issues on the jupyter repo using the link above. Include the log from the Jupyter output channel

Known Issues

@joaomoreno
Copy link
Member

joaomoreno commented Sep 29, 2021

I'm getting this, in the setup phase:

$ pip install ipykernel --pre
Collecting ipykernel
  Using cached https://files.pythonhosted.org/packages/d5/bd/6f983d5075fcb7f2c4e03846b9f922fbc81fc0bedb8c561e70ebd2640ee4/ipykernel-6.0.0a0-py3-none-any.whl
Collecting debugpy>=1.0.0 (from ipykernel)
  Using cached https://files.pythonhosted.org/packages/76/37/98d4867a68820592aed879cc20246c5e0165e127d86452b57119f3574cec/debugpy-1.4.3-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Collecting tornado>=4.2 (from ipykernel)
  Using cached https://files.pythonhosted.org/packages/01/d1/8750ad20cbcefb499bb8b405e243f83c2c89f78d139e6f8c8d800640f554/tornado-6.1-cp36-cp36m-manylinux1_x86_64.whl
Collecting ipython>=7.21.0 (from ipykernel)
  Could not find a version that satisfies the requirement ipython>=7.21.0 (from ipykernel) (from versions: 0.10, 0.10.1, 0.10.2, 0.11, 0.12, 0.12.1, 0.13, 0.13.1, 0.13.2, 1.0.0, 1.1.0, 1.2.0, 1.2.1, 2.0.0, 2.1.0, 2.2.0, 2.3.0, 2.3.1, 2.4.0, 2.4.1, 3.0.0, 3.1.0, 3.2.0, 3.2.1, 3.2.2, 3.2.3, 4.0.0b1, 4.0.0, 4.0.1, 4.0.2, 4.0.3, 4.1.0rc1, 4.1.0rc2, 4.1.0, 4.1.1, 4.1.2, 4.2.0, 4.2.1, 5.0.0b1, 5.0.0b2, 5.0.0b3, 5.0.0b4, 5.0.0rc1, 5.0.0, 5.1.0, 5.2.0, 5.2.1, 5.2.2, 5.3.0, 5.4.0, 5.4.1, 5.5.0, 5.6.0, 5.7.0, 5.8.0, 5.9.0, 5.10.0, 6.0.0rc1, 6.0.0, 6.1.0, 6.2.0, 6.2.1, 6.3.0, 6.3.1, 6.4.0, 6.5.0, 7.0.0b1, 7.0.0rc1, 7.0.0, 7.0.1, 7.1.0, 7.1.1, 7.2.0, 7.3.0, 7.4.0, 7.5.0, 7.6.0, 7.6.1, 7.7.0, 7.8.0, 7.9.0, 7.10.0, 7.10.1, 7.10.2, 7.11.0, 7.11.1, 7.12.0, 7.13.0, 7.14.0, 7.15.0, 7.16.0, 7.16.1)
No matching distribution found for ipython>=7.21.0 (from ipykernel)

Didn't manage to unblock myself from here. Let me know how I can proceed.

@joaomoreno
Copy link
Member

@DavidKutu suggested:

could you try removing the --pre?

Doing so gives me an unsupported version of ipykernel, so I'm stuck again:

Successfully installed ipykernel-5.5.5

@joaomoreno
Copy link
Member

Also, nitpicking: why do we go through great lengths to make sure we use virtual environments, but then python3 -m ipykernel install --user ends up putting something on my user's ~/.local folder? Seems strange to me.

@joaomoreno
Copy link
Member

Managed to unblock myself: I was on Ubuntu 18.04 and that somehow was causing the issue. On Ubuntu 20.04, I successfully installed ipykernel 6.4.1.

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

5 participants