VS Code Jupyter Notebook: IProgress not found
Asked Answered
C

2

6

I'm attempting to run a very simple tqdm script:

from tqdm.notebook import tqdm
for i in tqdm(range(10)):
    time.sleep(1)

but am met with:

IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html

My ipywidgets is v8.0.4 and jupyter v1.0.0... does tqdm not work anymore with VS Code Jupyter Notebook?

Cryogenics answered 4/2, 2023 at 23:17 Comment(0)
P
7

I had the same problem. Using this post I resolved it by running:

%pip install --upgrade jupyter ipywidgets
%jupyter nbextension enable --py widgetsnbextension # removed !pip on the recommendation of a comment.

import time
from tqdm.notebook import tqdm
for i in tqdm(range(10)):
    time.sleep(0.1)
Peek answered 15/4, 2023 at 21:28 Comment(5)
Minor thing: When using pip install from inside a notebook, you'll have a better experience if you don't use the exclamation point with it, and use the modern magic command added to insure the installation occurs in the environment being used by the kernel underlying the active notebook, see here for more about the modern magic commands added to overcome exclamation point shortcomings. You should be suggesting others use that in current Jupyter as well. ...Wessel
<continued> See the second paragraph here for a good summary of why the exclamation point use with install commands can lead to issues.Wessel
Thanks @Wayne, I've updated it. I noticed my linter recommending it but I had no idea why.Peek
I'm not sure the jupyter nbextension enable line should be without the exclamation point though? Did you verify that?Wessel
It does somewhat enterprisingly. I checked after I posted to be sure.Peek
S
6

This little syntax solved my problem

conda install -c conda-forge ipywidgets

Remember to restart your kernel after installation. It didn't work until I restarted my VS Code. Hope it helps

Skilling answered 28/5, 2023 at 12:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.