autoreject: Missing import for IPython console execution.

While trying out the new workflow tutorial, I ran into a couple of issues with the progress bars.

In a new environment, in the python console, nothing breaks, and the progress bar work. With the same environment, in the Spyder IPython console, I get:

Running autoreject on ch_type=eeg
Traceback (most recent call last):

  File "/Users/scheltie/Downloads/autoreject.py", line 81, in <module>
    ar.fit(epochs[:20])  # fit on a few epochs to save time

  File "/Users/scheltie/Documents/pyvenv/test/lib/python3.8/site-packages/autoreject-0.3.dev0-py3.8.egg/autoreject/autoreject.py", line 1007, in fit
    _run_local_reject_cv(epochs, thresh_func, this_picks,

  File "/Users/scheltie/Documents/pyvenv/test/lib/python3.8/site-packages/autoreject-0.3.dev0-py3.8.egg/autoreject/autoreject.py", line 766, in _run_local_reject_cv
    local_reject.fit(epochs)

  File "/Users/scheltie/Documents/pyvenv/test/lib/python3.8/site-packages/autoreject-0.3.dev0-py3.8.egg/autoreject/autoreject.py", line 680, in fit
    self.threshes_ = self.thresh_func(

  File "/Users/scheltie/Documents/pyvenv/test/lib/python3.8/site-packages/autoreject-0.3.dev0-py3.8.egg/autoreject/autoreject.py", line 435, in _compute_thresholds
    epochs_interp = _clean_by_interp(epochs, picks=picks,

  File "/Users/scheltie/Documents/pyvenv/test/lib/python3.8/site-packages/autoreject-0.3.dev0-py3.8.egg/autoreject/utils.py", line 228, in _clean_by_interp
    for ch_idx, (pick, ch) in enumerate(_pbar(list(zip(picks, ch_names)),

  File "/Users/scheltie/Documents/pyvenv/test/lib/python3.8/site-packages/autoreject-0.3.dev0-py3.8.egg/autoreject/utils.py", line 179, in _pbar
    pbar = ProgressBar(iterable, mesg=desc, **kwargs)

  File "/Users/scheltie/Documents/pyvenv/test/lib/python3.8/site-packages/mne-0.23.4-py3.8.egg/mne/utils/progressbar.py", line 80, in __init__
    self._tqdm = tqdm(

  File "/Users/scheltie/Documents/pyvenv/test/lib/python3.8/site-packages/tqdm/notebook.py", line 242, in __init__
    self.container = self.status_printer(self.fp, total, self.desc, self.ncols)

  File "/Users/scheltie/Documents/pyvenv/test/lib/python3.8/site-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

Missing ipywidgets dependency? If I install it with pip, I then get another error message spam in the console: ERROR:traitlets:No such comm target registered: jupyter.widget.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 28 (18 by maintainers)

Most upvoted comments

Ah, I didn’t realize I had fallen behind the latest version. I was on 0.24.1 and I see 1.0 is now out.

I just upgraded with pip install -U mne to 1.0 and got a different error about mne/externals, which I was struggling to find in my site-packages. Then I created an entirely new conda env, which worked fine. Thanks for asking 😃

Slick new visualizations with mne-1.0!

Oh, interesting. So autoreject is in fact running into the same issue! Thanks for the clarification!

@hoechenberger I guess a similar problem is occurring with openneuro-py, but it’s not the one at cause here. In this issue, the error is caused by the progress bar displayed by AutoReject.fit(), no?

That said, with openneuro version 2021.8, I do get an error, but maybe not the one you are expecting:

Hello! This is openneuro-py 2021.8. Great to see you!

      Please report problems and bugs at
      https://github.com/hoechenberger/openneuro-py/issues

Preparing to download ds002778 ...
Retrieving up to 12 files (5 concurrent downloads).
Traceback (most recent call last):

  File "/var/folders/b1/kx2x00x95ls80zzkct4647sh0000gn/T/ipykernel_10464/1020394274.py", line 14, in <module>
    openneuro.download(dataset=dataset, target_dir=target_dir,

  File "/Users/scheltie/Documents/pyvenv/test/lib/python3.8/site-packages/openneuro/download.py", line 637, in download
    asyncio.run(_download_files(**kwargs))

  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/asyncio/runners.py", line 33, in run
    raise RuntimeError(

RuntimeError: asyncio.run() cannot be called from a running event loop

The same code snippet works in the terminal, so the error is restricted to the IPython console. I’ll check the PR code and reply on the PR.