microsoft / vscode-jupyter

VS Code Jupyter extension
https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter
MIT License
1.3k stars 294 forks source link

Sometimes tqdm could not be rendered when reopening VSCode #16188

Closed Saltsmart closed 2 weeks ago

Saltsmart commented 3 weeks ago

Applies To

What happened?

  1. Create a ipynb file.
  2. Add a python cell and run it, ensuring a tqdm progress bar appears:
    
    from tqdm.notebook import tqdm
    from time import sleep

with tqdm(total=100) as pbar: for i in range(100): sleep(0.1) pbar.update()


4. Close and reopen VSCode.
5. The original output of this cell could vanish occasionally and the following appears:
![Image](https://github.com/user-attachments/assets/6e03bb30-1b8c-45b9-ab9b-7579b8f2be54)

### VS Code Version

Version: 1.95.1 (system setup) Commit: 65edc4939843c90c34d61f4ce11704f09d3e5cb6 Date: 2024-10-31T05:14:54.222Z Electron: 32.2.1 ElectronBuildId: 10427718 Chromium: 128.0.6613.186 Node.js: 20.18.0 V8: 12.8.374.38-electron.0 OS: Windows_NT x64 10.0.22000

### Jupyter Extension Version

v2024.10.0

### Jupyter logs

_No response_

### Coding Language and Runtime Version

Python 3.10.12 (but it seem not related to this issue since same things happen in Python 3.12)

### Language Extension Version (if applicable)

Python Extension v2024.18.0

### Anaconda Version (if applicable)

_No response_

### Running Jupyter locally or remotely?

Local
DonJayamanne commented 3 weeks ago

Please can you share the contents of the notebook after you have completed the execution of the above cell.

Saltsmart commented 3 weeks ago

Please can you share the contents of the notebook after you have completed the execution of the above cell.

Sometimes it seems to be:

Could not render content for 'application/vnd.jupyter.widget-view+json'
{"model_id":"1a73d4b8a112420ba6037ab50c6cc710","version_major":2,"version_minor":0}

It often happens across large ipynb files, with "model_id" varied. I have checked the ipynb output content in the bulit-in text editor, and found there is no problem:

  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "1a73d4b8a112420ba6037ab50c6cc710",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "  0%|          | 0/1828 [00:00<?, ?it/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
Saltsmart commented 3 weeks ago

I think it because in the restarting (start process of VSCode, reactivating terminals, Pylance re-analysis of the code, or something else) the tqdm bar couldn't be rendered.

DonJayamanne commented 2 weeks ago

I think it because in the restarting

Does this issue repro when you disable all extensions except for the following

Saltsmart commented 2 weeks ago

Image

I think it because in the restarting

Does this issue repro when you disable all extensions except for the following

  • Jupyter
  • Notebook Renderers
  • Python

Seem that it is not happening (for now).

However when I re-enable the disabled extensions and restart the window, the bug still not happens:

Image

DonJayamanne commented 2 weeks ago

Given that you can no longer repro this let’s close this for now