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

[BUG] - ipywidgets in JupyterLab behaves different if installed in Dockerfile #1715

Closed
fauxneticien opened this issue May 28, 2022 · 2 comments
Labels
type:Bug A problem with the definition of one of the docker images maintained here

Comments

@fauxneticien
Copy link

What docker image(s) are you using?

base-notebook

OS system and architecture running docker image

macOS/aarch64 (Mac Mini) + BinderHub

What Docker command are you running?

docker build . -t jupyter/base-notebook:lab-3.4.2_ipywidgets and then docker run --rm -p 8888:8888 jupyter/base-notebook:lab-3.4.2_ipywidgets

Dockerfiles:

I have tried both:

FROM jupyter/base-notebook:lab-3.4.2

RUN pip install ipywidgets

and, trying to solve it the same way as #1434,

FROM jupyter/base-notebook:lab-3.4.2

RUN jupyter lab clean --all && \
    pip install --no-cache-dir --upgrade ipywidgets && \
    jupyter labextension install @jupyter-widgets/jupyterlab-manager

How to Reproduce the problem?

Build Docker file, open a new Python 3 Console in JupyterLab then run:

from tqdm.auto import tqdm
from time import sleep

for i in tqdm(range(3)):
    sleep(1)

Or use Binder: https://mybinder.org/v2/gh/parledoct/tutorials/binderhub?urlpath=lab, built from https://github.com/parledoct/tutorials/blob/binderhub/Dockerfile

Command output

No response

Expected behavior

If you launch a plain jupyter/base-notebook:lab-3.4.2 without ipywidgets, tqdm prompts you to install ipywidgets but at least a progress bar displays. Then, once you install ipywidgets, there is no more warning and a progress bar displays.

Screen Shot 2022-05-28 at 12 27 30 PM

Or see Binder: https://mybinder.org/v2/gh/fauxneticien/tqdm-jupyterlab/main?urlpath=lab, built from https://github.com/fauxneticien/tqdm-jupyterlab/blob/main/Dockerfile

Actual behavior

If ipywidgets is installed in the Docker build (e.g. with RUN pip install ipywidgets) then tqdm progress bar does not appear, only Loading widget...

Screen Shot 2022-05-28 at 12 27 37 PM

Anything else?

I can get a progress bar to appear if I use from tqdm import tqdm instead of from tqdm.auto import tqdm but that isn't an option because I originally came down this rabbit hole because huggingface_hub uses from tqdm.auto import tqdm in their code (https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/file_download.py#L18). So when the progress bar doesn't show, I can't track how a multi-gigabyte file download is going...

@fauxneticien fauxneticien added the type:Bug A problem with the definition of one of the docker images maintained here label May 28, 2022
@mathbunnyru
Copy link
Member

You're using ipywidgets in jupyterlab console.
I don't think they are officially supported.
jupyter-widgets/ipywidgets#2370

I have no idea though why they work when !pip install from the console itself.
As there is no support from the upstream, I think the best way for you is to switch to running your code in notebook, not in console.

I've checked and it works fine in notebooks.

@fauxneticien
Copy link
Author

You're using ipywidgets in jupyterlab console.
I don't think they are officially supported.
jupyter-widgets/ipywidgets#2370

Oh, I see — sorry, then I didn't come across this issue. I'll close this one...

I've checked and it works fine in notebooks.

Yep, same

I have no idea though why they work when !pip install from the console itself.
As there is no support from the upstream, I think the best way for you is to switch to running your code in notebook, not in console.

Fair point. Indeed this makes jupyter lab far less appealing (as someone else has also noted...)

CommonClimate commented on Dec 28, 2021

+1 for issue above. I generally think of JupyterLab as "all the things jupyter notebook does and more" but this issue rains on the jlab parade in a significant way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:Bug A problem with the definition of one of the docker images maintained here
Projects
None yet
Development

No branches or pull requests

2 participants