+4 votes
in Programming Languages by (75.1k points)

I am using tqdm() module in my code and am getting the following error:

    for mu, s in tqdm(params):

  File "/usr/local/lib/python3.8/dist-packages/tqdm/__init__.py", line 28, in tqdm_notebook

    return _tqdm_notebook(*args, **kwargs)

  File "/usr/local/lib/python3.8/dist-packages/tqdm/notebook.py", line 242, in __init__

    self.container = self.status_printer(self.fp, total, self.desc, self.ncols)

  File "/usr/local/lib/python3.8/dist-packages/tqdm/notebook.py", line 115, in status_printer

    raise ImportError(

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

Exception ignored in: <function tqdm.__del__ at 0x7f0515da3700>

Traceback (most recent call last):

  File "/usr/local/lib/python3.8/dist-packages/tqdm/std.py", line 1147, in __del__


  File "/usr/local/lib/python3.8/dist-packages/tqdm/notebook.py", line 286, in close

    self.disp(bar_style='danger', check_delay=False)

AttributeError: 'tqdm_notebook' object has no attribute 'disp'

How can I fix the error? 

1 Answer

+2 votes
by (353k points)
selected by
Best answer

As the error suggests, you have to install/upgrade libraries ipywidgets and jupyter.

sudo pip install -U ipywidgets

sudo pip install -U jupyter

After installing these packages, if the problem persists, you can install/upgrade the library notebook, too.

sudo pip install -U notebook

Hopefully, this will fix the error.