rsalmei / alive-progress

A new kind of Progress Bar, with real-time throughput, ETA, and very cool animations!
MIT License
5.53k stars 206 forks source link

Hangs in Jupyter Notebook on Mac Mini M1 #119

Closed ard9000 closed 2 years ago

ard9000 commented 2 years ago

It hangs before the first loop. Same notebook works fine on Intel macs.

Output from command line:

[IPKernelApp] ERROR | Exception in message handler:
Traceback (most recent call last):
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/alive_progress/core/progress.py", line 254, in __alive_bar
    yield bar
  File "/var/folders/9s/b5g333z52k91f3r41lqqynww0000gp/T/ipykernel_40714/1795187101.py", line 34, in <module>
    bar()
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/alive_progress/core/progress.py", line 274, in __call__
    self._handle(*args, **kwargs)
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/alive_progress/core/progress.py", line 138, in bar_handle
    hook_manager.flush_buffers()
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/alive_progress/core/hook_manager.py", line 27, in flush_buffers
    flush(stream)
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/alive_progress/core/hook_manager.py", line 31, in flush
    write(stream, '\n')
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/alive_progress/core/hook_manager.py", line 48, in write
    term.clear_line()
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/alive_progress/utils/terminal/jupyter.py", line 8, in clear_line
    c = cols()
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/alive_progress/utils/terminal/tty.py", line 32, in cols
    return os.get_terminal_size()[0]
OSError: [Errno 25] Inappropriate ioctl for device
codecrap commented 2 years ago

Can confirm having the same problem, but I am running an Intel Thinkpad with Linux (Kernel 5.13.9). Not sure that this bug is hardware related though

TheTechRobo commented 2 years ago

I don't think it's hardware related. Are you using another environment such as JupyterLab?

codecrap commented 2 years ago

I have tested it on jupyter notebook, jupyter lab and inside Pycharm Professional's (2021.3) notebook viewer, all having the same problem. All using python 3.8.8, output of jupyter --version:

jupyter core     : 4.7.1
jupyter-notebook : 6.4.0
qtconsole        : 5.1.1
ipython          : 7.23.1
ipykernel        : 6.4.1
jupyter client   : 6.1.12
jupyter lab      : 3.2.3
nbconvert        : 6.0.7
ipywidgets       : 7.6.5
nbformat         : 5.1.3
traitlets        : 5.0.5
rsalmei commented 2 years ago

Hello, Yeah, this doesn't seem related to hardware. This is a normal Python error: https://docs.python.org/3/library/os.html#os.get_terminal_size But I can't understand why it wouldn't be connected to a terminal...

Does it work on a normal cell?

import os
os.get_terminal_size()
rsalmei commented 2 years ago

This is going to be fixed today, in #129!