Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In Notebook: AttributeError: 'tqdm' object has no attribute 'sp' #11

Closed
LIU-Yinyi opened this issue Aug 29, 2021 · 5 comments · Fixed by #12
Closed

In Notebook: AttributeError: 'tqdm' object has no attribute 'sp' #11

LIU-Yinyi opened this issue Aug 29, 2021 · 5 comments · Fixed by #12
Assignees
Labels
bug Something isn't working

Comments

@LIU-Yinyi
Copy link

When using mpire in jupyter notebook, there is an error when enabling progress_bar=True:

Process ForkProcess-34:
Traceback (most recent call last):
  File "/home/ubuntu/anaconda3/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/home/ubuntu/anaconda3/lib/python3.8/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/home/ubuntu/anaconda3/lib/python3.8/site-packages/mpire/progress_bar.py", line 194, in _progress_bar_handler
    progress_bar.sp(bar_style='success')
AttributeError: 'tqdm' object has no attribute 'sp'

After reviewing the codes in Line 194, sp seems to be activated only when in_notebook is True:

if in_notebook:
    progress_bar.sp(bar_style='success')

Testing Environment

  • OS: Ubuntu 16.04
  • Interpreter: Python 3.8.8 [GCC 7.3.0]
  • Libraries: mpire (2.1.1), tqdm (4.62.2), jupiter (1.0.0)
@LIU-Yinyi
Copy link
Author

Finally I found where the problem located. In tqdm 4.62.2, the API is changed to disp instead of sp for notebook. Simply modify the codes in Line 169 and 194:

progress_bar.disp(bar_stype='danger')
progress_bar.disp(bar_stype='success')

@sybrenjansen
Copy link
Owner

Thnx for locating the problem. I will look for a fix that's backwards compatible and hopefully future proof as well.

@sybrenjansen sybrenjansen self-assigned this Aug 30, 2021
@sybrenjansen sybrenjansen added the bug Something isn't working label Aug 30, 2021
@morganmcg1
Copy link

just hit this too in a (kaggle) notebook, really excited about this library, would be great to have an easy to use progress bar for MP!

@sybrenjansen
Copy link
Owner

Has been fixed in v2.2.1 release.

@morganmcg1 great to here you're excited about the library!

@morganmcg1
Copy link

Its a thing of beauty, thank you!

Screenshot 2021-08-31 at 16 16 25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants