question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Jupyter bugs: Out of sync source code

See original GitHub issue

Bug: Notebook Editor, Interactive Window, Editor cells

Steps to cause the bug to occur

  1. Run long execution code like Keras neural networking training
  2. Editing cells as code being executed while enabling autosaves
  3. Sometimes code blocks show on vscode notebook is different than code blocks store on disk.
  4. Have to close and reopen the file to see actual editing that occurs

Description

I encounter a problem with Jupyter notebook where source code on display in vscode is different that source code on disk(I assume this is the code executed by the kernel). I need to reopen the ipynb file to see the updated code. The problem usually occurs when cells are being executed and I make some editing to the code. For example, if I comment out multiple lines of code, it looks correct in vscode but it will throw a syntax error when I execute the cell. Upon reopening the ipynb file, the “#” is being inserted in the middle of a line instead of at the beginning like what vscode shown previously. Enable “Auto Save” causes the bug to occur more often. I started to have this problem two patches ago.

Actual behavior

VSCode Notebook before edit:

fc_model.add(layers.Dense(2500, activation="relu"))
fc_model.add(layers.Dense(2000, activation="relu"))
fc_model.add(layers.Dense(1500, activation="relu"))
fc_model.add(layers.Dense(1000, activation="relu"))
fc_model.add(layers.Dense(500, activation="relu"))

VSCode Notebook after edit:

# fc_model.add(layers.Dense(2500, activation="relu"))
# fc_model.add(layers.Dense(2000, activation="relu"))
# fc_model.add(layers.Dense(1500, activation="relu"))
# fc_model.add(layers.Dense(1000, activation="relu"))
# fc_model.add(layers.Dense(500, activation="relu"))

Code stored on disk after edit:

fc_model.add(lay#ers.Dense(2500, activation="relu"))
fc_model.add(layers.Dense(2000#, activation="relu"))
fc_model.add(layer#s.Dense(1500, activation="relu"))
fc_model.a#dd(layers.Dense(1000, activation="relu"))
fc_model.add(laye#rs.Dense(500, activation="relu"))

Expected behavior

VSCode Notebook before edit:

fc_model.add(layers.Dense(2500, activation="relu"))
fc_model.add(layers.Dense(2000, activation="relu"))
fc_model.add(layers.Dense(1500, activation="relu"))
fc_model.add(layers.Dense(1000, activation="relu"))
fc_model.add(layers.Dense(500, activation="relu"))

VSCode Notebook after edit:

# fc_model.add(layers.Dense(2500, activation="relu"))
# fc_model.add(layers.Dense(2000, activation="relu"))
# fc_model.add(layers.Dense(1500, activation="relu"))
# fc_model.add(layers.Dense(1000, activation="relu"))
# fc_model.add(layers.Dense(500, activation="relu"))

Code stored on disk after edit:

# fc_model.add(layers.Dense(2500, activation="relu"))
# fc_model.add(layers.Dense(2000, activation="relu"))
# fc_model.add(layers.Dense(1500, activation="relu"))
# fc_model.add(layers.Dense(1000, activation="relu"))
# fc_model.add(layers.Dense(500, activation="relu"))

Your Jupyter and/or Python environment

Please provide as much info as you readily know

  • Jupyter server running: Local
  • Extension version: 2020.3.69010
  • VS Code version: 1.43.2
  • Setting python.jediEnabled: true
  • Python and/or Anaconda version: 3.6 and 4.8.2
  • OS: Windows
  • Virtual environment: conda

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
RMelicommented, Apr 3, 2020

After a few more test I don’t get the error every time, but it happens often with the current version. I didn’t menage to get the same errors with the insider version.

1reaction
rchiodocommented, Mar 25, 2020

Yes the model updating was different then. It was actually at a different level this problem would manifest itself.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I fix a JupyterLab "Code Editor out of Sync" error ...
Jupyter Lab version 3.0.3 and Python version 3.7.7. I'm using both Chrome and Safari. I am still seeing the same issue. enter image...
Read more >
How To Fix A Jupyterlab "Code Editor Out Of Sync" Error ...
I am seeing this error message Code Editor out of Sync Please open your browser JavaScript console for bug report instructions in my...
Read more >
Code Editor Out of Sync after using Sublime Text
I was writing a .py file in JupyterLab because I wanted to run it on streamlit alongside. Then, after I confirmed that the...
Read more >
JupyterLab Changelog — JupyterLab 3.6.0b0 documentation
JupyterLab now supports showing the current file in use in the browser URL bar, similar to the classic Jupyter Notebook. Table of Contents...
Read more >
Visual Studio Code Frequently Asked Questions
How do I opt out of VS Code auto-updates? Licensing; Are all VS Code extensions open source? How do I find the version?...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found