Closed avlm closed 3 years ago
Hey @avlm, how are you?
Unfortunately there's no support for jupyter notebook. It may have someday, but it is not in the short term plans.
Ok, @rsalmei. Você é brasileiro? kkk Me avisa se eu puder ajudar com isso, seria um prazer.
Alô @avlm!
Então, sou brasileiro sim, mas como vc percebeu? hehehe
Enfim, adoraria alguma ajuda nisso, não faço ideia de como desenhar widgets (gráficos) num jupyter notebook. Já leu alguma coisa sobre?
opa! percebi pelo teu nome do github kkkk eu consegui fazer usando uma lib chamada tqdm, ela é bem simples também, vale a pena dar uma conferida.
O que poderia fazer era indicar ela no README caso a pessoa deseje usar num jupyter. Ou colocar ela como dependência do alive-progress e fazer uma verificacão do ambiente para caso seja um notebook fazer um "fallback" e usar o tqdm. Só não sei se seria tão simples de fazer as customizacões que o alive-progress tem funcionarem no tqdm.
qualquer coisa estamos aí. :D
[edit - in English] Actually, tqdm is another progress bar implementation, not a backend for graphically drawing within a notebook. For that we would need ipywidgets and ipycanvas, I just have never used them, and have no experience in HTML at all, which I think it would be needed.
Massa! Vou dar uma olhada no ipywidgets e no ipycanvas pra tentar dar uma força nisso aí. Valeu!
Eu que agradeço! 👍 (vou manter o ticket aberto)
@thorstenkampe (I suggest using this open issue for discussion)
https://github.com/tqdm/tqdm/blob/master/tqdm/notebook.py is the relevant TQDM file, FWIW.
Nice @TheTechRobo, I'm also going to move my reply here.
Maybe that could get Alive-Progress started?!
Yeah, I know it does @thorstenkampe, thanks. It has an adapter, to convert their bar to a GUI environment, as a jupyter widget. Well, the goal in tqdm is just to see a process, the goal here is to see it in style. Tqdm only updates the bar passively, when there's any change. Here I refresh the bar dynamically, from 4 up to 60 frames per second based on the processing speed, and I don't know if that would even be supported in notebooks... So, It's not an easy task at all.
Anyway, I did a quick look at their code, and it does not even draw the actual bar, it uses an internal ready-to-use component of ipywidgets (FloatProgress):
https://github.com/tqdm/tqdm/blob/master/tqdm/notebook.py#L48
So, perhaps it really wouldn't be so hard to support something like it, using that same approach. It surely wouldn't support all the bells and whistles that alive-progress does have, but it would be OK as an MVP... Thanks 👍.
Hi Rogério, just wanted to mention that bare-bones (text based, not widget based) notebook support would be really important. I understand your concern about style, but having something show up in the notebook would be still very desirable. Thanks
Hey @radugrosu, I hear you... I just tried here a few quick and dirty workarounds, and it seems it DOES work!! Look at this:
Unfortunately I do not have much free time at the moment, but I'll return to this asap 👍
EDIT: Well, it "works" actually, I've just noticed at the end, the ANSI Escape code for "clearing the line from cursor" did not work, leaving garbage after the final receipt, but I think it could be acceptable, or I could try to actually print spaces there.
Looks great :tada: . Can we have that? :pray:
Thanks! Yeah, I do agree it looks great! 😊 I've working on this these days, but as I said I have very little free time nowadays, can't really focus on it. But you can be sure I'll release this 👍
Hey, the PR is ready to fix this! #111 I'll release it very soon...
Hey, version 2.1
is released!!
This should be fixed, please report back if anything new arises.
Hello! Looks like a great program. I am using JupyterLab, and this is my output from your code above:
You can see my environment here: 20211124requirements.txt
Hey @samwelborn, I'm not familiar with this JupyterLab, I've never used it.
I just tested it on Jupyter Notebook.
Do you know if it have any major architectural differences?
By the look of your output, it seems \r
is being ignored, which is critical...
@rsalmei JupyterLab is a web based UI for Jupyter Notebook.
That's the extent off my knowledge.
Jupyter Lab is an enhanced version of Jupyter Notebook.
I just tried to do this on a fresh environment without jupyterlab: alive-progress-testing.txt
For whatever reason (old version of conda in my base env, maybe), doing "conda install -c anaconda notebook" gave me notebook version 6.1.4. This produced the same result (in notebook):
I also tried this in notebook (v6.4.6), and it produced the same result.
What version of notebook did you test this out on @rsalmei? Would love to use your progress bars in my interactive notebook!
Humm I see, I can try to download it and test that sometime.
Anyway, that's very odd @samwelborn, mine is not that recent also... I've been lazy and haven't updated my python env in a long time, this is what I'm running now (using dark reader):
So you see, 6.1.1 in a python 3.8.2... And it works flawlessly for the most part:
Well, and I don't think they would drop this support somehow in newer Jupyters, but I can update everything here if you feel that could be relevant...
Thanks! I also would love that you have used my alive-progress
bar! 😃
:)
I tried to install your environment:
and it's still doing the same:
Do you think it could be a windows issue?
I just tried to run the same commands you have above inside a script from the command prompt on 2 different windows 10 machines:
And I get these ? symbols instead of the symbols for the bar. The repetitive printing stuff is gone, so it could be a new/different issue.
Same with your demo:
[The terminal issue is] just a bad font. Install a Nerd Font and configure cmd to use it.
Is there a way to use alive-progress with jupyter notebooks? I tried but it's printing in my command line instead of notebook, and the output is like this:
|████████▌ | ▅▇▇ 214/1000 [21%] in 21s ... |████████▌ | ▆█▆ 215/1000 [22%] in 21s ... |████████▋ | ▇▇▅ 216/1000 [22%] in 21s ...
Update: Python==2.7.15 Django==1.8.4
I'm using jupyter notebook with django-shell-plus to use django models