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

Running cells is broken / cells execute in wrong order #4090

Open
stmax82 opened this issue Oct 11, 2018 · 10 comments
Open

Running cells is broken / cells execute in wrong order #4090

stmax82 opened this issue Oct 11, 2018 · 10 comments

Comments

@stmax82
Copy link

stmax82 commented Oct 11, 2018

Since I upgraded Jupyter to 5.7.0 a few days ago I noticed the following several times both at work and at home:

When I click "Kernel" -> "Restart & Run All" some cells are skipped and the following cells fail execution (because they depend on results of the previous cells).

Also executing multiple cells with Shift-Enter also produces the same problem.

Here's an example:

restartrunall

As you can see the cell with e = d + 1 was skipped and the following cell with f = e + 1 failed because it depends on e.

The result is not deterministic - when I repeat it, the problem either happens at another cell or (most often) not at all.. you might have to try quite a few times.

Sometimes it also skips more than one cell before failing. (Maybe it's not skipping cells - but executing them in the wrong order?)

jupyter

@stmax82 stmax82 changed the title Restart & Run All is broken Running cells is broken / cells execute in wrong order Oct 11, 2018
@stmax82
Copy link
Author

stmax82 commented Oct 11, 2018

This shows that cells are not skipped, but executing in the wrong order:

wrongorder

(As above - not deterministic.. might have to try several times)

@stmax82
Copy link
Author

stmax82 commented Oct 11, 2018

I just downgraded notebook to my previous version of 5.5.0 (with conda install notebook=5.5)... and the problem persists!?

What other packages could be causing this? (I ran conda update --all a few days ago...)

987

@stmax82
Copy link
Author

stmax82 commented Oct 11, 2018

I found a conda environment that I created a few months ago and the problem does not happen there.

So I tried downgrading single packages until the bug disappeared - it looks like the package ipykernel is responsible for the bug.

The problem happens with ipykernel 5.0.0, but does not happen with 4.8.2 (that was my previously installed version).

ipykernel 4.10.0 also does not have this bug.. looks like it was introduced somewhere between 4.10.0 and 5.0.0.

@janamejaya
Copy link

Upgrading ipykernel to version 5.1.0 solved this problem for me.

@mtonkins
Copy link

I reinstalled ipykernal, but now a kernal does not load. with the following issue:

Traceback (most recent call last):
  File "C:\Users\mct217\AppData\Local\Continuum\anaconda3\envs\PhD\lib\site-packages\tornado\web.py", line 1592, in _execute
    result = yield result
  File "C:\Users\mct217\AppData\Local\Continuum\anaconda3\envs\PhD\lib\site-packages\tornado\gen.py", line 1133, in run
    value = future.result()
  File "C:\Users\mct217\AppData\Local\Continuum\anaconda3\envs\PhD\lib\site-packages\tornado\gen.py", line 1141, in run
    yielded = self.gen.throw(*exc_info)
  File "C:\Users\mct217\AppData\Local\Continuum\anaconda3\envs\PhD\lib\site-packages\notebook\services\sessions\handlers.py", line 73, in post
    type=mtype))
  File "C:\Users\mct217\AppData\Local\Continuum\anaconda3\envs\PhD\lib\site-packages\tornado\gen.py", line 1133, in run
    value = future.result()
  File "C:\Users\mct217\AppData\Local\Continuum\anaconda3\envs\PhD\lib\site-packages\tornado\gen.py", line 1141, in run
    yielded = self.gen.throw(*exc_info)
  File "C:\Users\mct217\AppData\Local\Continuum\anaconda3\envs\PhD\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 79, in create_session
    kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name)
  File "C:\Users\mct217\AppData\Local\Continuum\anaconda3\envs\PhD\lib\site-packages\tornado\gen.py", line 1133, in run
    value = future.result()
  File "C:\Users\mct217\AppData\Local\Continuum\anaconda3\envs\PhD\lib\site-packages\tornado\gen.py", line 1141, in run
    yielded = self.gen.throw(*exc_info)
  File "C:\Users\mct217\AppData\Local\Continuum\anaconda3\envs\PhD\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 92, in start_kernel_for_session
    self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name)
  File "C:\Users\mct217\AppData\Local\Continuum\anaconda3\envs\PhD\lib\site-packages\tornado\gen.py", line 1133, in run
    value = future.result()
  File "C:\Users\mct217\AppData\Local\Continuum\anaconda3\envs\PhD\lib\site-packages\tornado\gen.py", line 326, in wrapper
    yielded = next(result)
  File "C:\Users\mct217\AppData\Local\Continuum\anaconda3\envs\PhD\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 160, in start_kernel
    super(MappingKernelManager, self).start_kernel(**kwargs)
  File "C:\Users\mct217\AppData\Local\Continuum\anaconda3\envs\PhD\lib\site-packages\jupyter_client\multikernelmanager.py", line 110, in start_kernel
    km.start_kernel(**kwargs)
  File "C:\Users\mct217\AppData\Local\Continuum\anaconda3\envs\PhD\lib\site-packages\jupyter_client\manager.py", line 259, in start_kernel
    **kw)
  File "C:\Users\mct217\AppData\Local\Continuum\anaconda3\envs\PhD\lib\site-packages\jupyter_client\manager.py", line 204, in _launch_kernel
    return launch_kernel(kernel_cmd, **kw)
  File "C:\Users\mct217\AppData\Local\Continuum\anaconda3\envs\PhD\lib\site-packages\jupyter_client\launcher.py", line 128, in launch_kernel
    proc = Popen(cmd, **kwargs)
  File "C:\Users\mct217\AppData\Local\Continuum\anaconda3\envs\PhD\lib\subprocess.py", line 756, in __init__
    restore_signals, start_new_session)
  File "C:\Users\mct217\AppData\Local\Continuum\anaconda3\envs\PhD\lib\subprocess.py", line 1155, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

@janamejaya
Copy link

I just did the following:

A) Clean reinstall of Anaconda3-5.3.0 (python 3.7) on my Windows 10 desktop
B) Execute the following commands (exclude # and whatever comes after it) from the Anaconda prompt in the base environment

  1. conda update conda # was up to date anyway, so redundant
  2. conda update Anaconda # was up to date anyway, so redundant
  3. conda update --all # updates a few packages
  4. conda update -c defaults - c conda-forge ipykernel # updates to ipykernel 5.1.0 or whatever is current
  5. jupyter notebook your_notebook_name.ipynb --debug

I did not get any errors and the notebook did not skip cells upon execution.

If reinstall is not a problem, could you try this out ? Otherwise, make a new environment and try steps (3?), 4 and 5 from it

@jSieber7
Copy link

There may be a bit more than simply upgrading to 5.1. Installed 5.1 from forge, and I still run into the skip cell bug.

image
image

@janamejaya
Copy link

I have tried at least 5 clean Anaconda re-installs on my windows desktop and each time the skip cell problem in Jupyter notebooks was fixed by upgrading ipykernel. However, I suspect that something else may be wrong. I have an open issues thread related to a post-ipykernel upgrade problem.

@GDelevoye
Copy link

GDelevoye commented Feb 2, 2021

The exact same problem is still there for me with ipykernel 5.1.2

Additionnal remarks for me:

  • Some notebooks work perfectly fine when using "run everything" but don't when running cells fast manually
  • I am not 100% sure but maybe some notebooks are corrupted because copy/pasting the cells one by one to another notebook seems to fix the problem

On my computer it happens if my import take more time than usual to run

@SchmelleDev
Copy link

Same problem is still there for me with ipykernel 6.25.2 on jupyterlab 4.0.6.
I get a wrong execution sequence of [9], [11], [10].
I do nothing special, mainly pandas commands to read and process data.

Selection of first 12 cells and "run selected" leads to a cell skip in cell 3.

Using:
"%load_ext autoreload
%autoreload 2"
in the first cell, the skip disappered, but the sequence issue remains for running the first 12 marked cells.

grafik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants