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

Jupyter Notebook cells running out of order #2316

Closed
alanhett opened this issue Feb 10, 2020 · 12 comments
Closed

Jupyter Notebook cells running out of order #2316

alanhett opened this issue Feb 10, 2020 · 12 comments
Assignees

Comments

@alanhett
Copy link

Steps to cause the bug to occur

  1. Create a Jupyter Notebook with multiple cells
  2. Click run all cells or any command that runs multiple cells

Actual behavior

Occasionally, cells run out of order, or they are not waiting for execution to finish before the next cell is run. For example, I'll run import pandas as pd and the next cell will run before pd is set.

Expected behavior

Cells should run in the correct order. Execution on one cell should complete before the next cell starts.

This does not occur in Jupyter Lab when I run it in a browser window. Only in VS Code.

@DavidKutu
Copy link

Hi @alanhett, thank you for reporting your issue. I'm trying to reproduce it but can't get it. When pressing 'run all cells', the cell execution count does change to a '*' in all cells to indicate that they are running. But they do execute in order for me.

Are you getting errors like 'pandas is not defined'?

@alanhett
Copy link
Author

Correct, let me re-run the specific file I was having issues with and see if I can provide more specifics.

@alanhett
Copy link
Author

alanhett commented Feb 10, 2020

2nd cell ran first

@DavidKutu got it to reproduce. Here are the specifics:

  1. I had the 2nd cell selected
  2. I clicked run all cells (the circled button)
  3. The 2nd cell ran first

Correct me if I'm wrong, but if I click run all cells, it shouldn't matter what cell I have selected right? They should all run in order, top-to-bottom?

Note that this is an intermittent problem. It happens maybe 1 out of 10 times that I run it. I had to restart the kernel several times to get it to reproduce.

@alanhett
Copy link
Author

@DavidKutu just confirming I also tried this selecting the first cell, and clicking the "run cell and below" button and still got the out-of-order execution on occasion. So I don't think it matters what I do, things are running out of order.

@DonJayamanne
Copy link
Contributor

DonJayamanne commented Feb 10, 2020

@alanhett thanks for the steps.
I did see this last week, but ignored it as i thought I was doing something wrong. I too used run all cells icon.
So, yes this is a bug, as its not what I expected and I've experienced this.

@DavidKutu
Copy link

@alanhett Thank you for the steps! We'll look into it.

@sergiykhan
Copy link

I confirm that some cells get skipped, while some are executed out of order. I just started using VS Code yesterday. Whether I use an Anaconda kernel or a kernel installed in WSL, the issue is the same. Note that using the same Anaconda kernel in the Anaconda-bundled Notebook works as expected.

@Juan-132
Copy link

I have had this issue as well using run all cells. Executing all cells using shift enter works as expected

@sergiykhan
Copy link

Executing all cells using shift enter works as expected

The expected behavior for "Shift + Enter" is to run the current cell. How can it run all cells?

@Juan-132
Copy link

If you hold shift and press enter frequently /rapidly. It will not skip any cells, or execute them out of order

@hfactor13
Copy link

@alanhett I have the same issue as well. I am glad I am not the only one that has had this problem.
Screen Shot 2020-02-18 at 10 13 26 PM

@rchiodo rchiodo self-assigned this Feb 19, 2020
@IanMatthewHuff IanMatthewHuff self-assigned this Feb 20, 2020
@IanMatthewHuff
Copy link
Member

Validated. With a few different files Notebook editor + interactive window. Tried different UI sets (run all cells, run cells below, fast shift-enters) and was not able to repro out of order exection.

@lock lock bot locked as resolved and limited conversation to collaborators Feb 28, 2020
@microsoft microsoft unlocked this conversation Nov 13, 2020
@DonJayamanne DonJayamanne transferred this issue from microsoft/vscode-python Nov 13, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants