ipympl icon indicating copy to clipboard operation
ipympl copied to clipboard

MyBinder + ipympl: RuntimeError: JupyterLab failed to build

Open paugier opened this issue 4 years ago • 17 comments

I'd like to play with Voila, MyBinder and ipympl. Unfortunately, I can't get ipympl to work with JupyterLab in MyBinder :slightly_frowning_face:

But actually, the issue can be reproduced with your MyBinder badge!

https://mybinder.org/v2/gh/matplotlib/ipympl/stable?urlpath=%2Flab%2Ftree%2Fexamples%2Fipympl.ipynb

paugier avatar Sep 07 '20 10:09 paugier

I've noticed this in another repo. It might have something to do with conda not installing the right nodejs version, I've seen this issue many times. What happens if you pin nodejs to the latest version 14.9.0?

martinRenou avatar Sep 07 '20 10:09 martinRenou

Same thing with nodejs pinned.

Step 50/53 : RUN ./postBuild
 ---> Running in a4c0c5c4d1f5
Building jupyterlab assets (build:prod:minimize)
An error occured.
RuntimeError: JupyterLab failed to build
See the log file for details:  /tmp/jupyterlab-debug-awwlsy5i.log
Building jupyterlab assets (build:prod:minimize)
An error occured.
RuntimeError: JupyterLab failed to build
See the log file for details:  /tmp/jupyterlab-debug-4a8ix4ok.log
Removing intermediate container a4c0c5c4d1f5
The command '/bin/sh -c ./postBuild' returned a non-zero code: 1

Not related to pinning nodejs, but I saw that sometimes, there is no error...

paugier avatar Sep 07 '20 12:09 paugier

Running jupyter labextension install with the --debug option might give some more information.

martinRenou avatar Sep 07 '20 12:09 martinRenou

It seems better with --dev-build=False --minimize=False. If I still get problems, I'll try with --debug.

Wouldn't it be good to have a specific section on using ipympl with MyBinder in the README or the doc? Maybe there is already one and I didn't see it :slightly_smiling_face:

paugier avatar Sep 07 '20 12:09 paugier

Wouldn't it be good to have a specific section on using ipympl with MyBinder in the README or the doc?

Not sure I get what you mean. What exactly do you think should be added to the README? Using ipympl on MyBinder is just like using any other library on MyBinder, you "just" need to install it.

The fact that ipympl does not work anymore is unfortunate and I would say it's not really ipympl's fault as I could reproduce what seems to be the same issue with Binder with another repo (bqplot), and ipympl works just fine locally and in the CI.

martinRenou avatar Sep 07 '20 12:09 martinRenou

Yes, I guess you are right.

Just I had to struggle a bit with the installation and setup. (i) figure out how to use JupyterLab instead of Jupyter notebook (the default in MyBinder). (ii) A file postBuild is needed with something like:

#!/bin/bash

# A way for mybinder.org to realize it should install the jupyter lab extension
# automatically. This file does not affect anything except when mybinder.org use
# it for this specifically.
jupyter labextension install @jupyter-widgets/jupyterlab-manager --dev-build=False --minimize=False
jupyter labextension install jupyter-matplotlib --dev-build=False --minimize=False

paugier avatar Sep 07 '20 13:09 paugier

It cannot harm adding it to the README indeed, would you like to open a PR?

So you're saying that --dev-build=False --minimize=False fixed the issue? And we actually need both options to False? I'll try with bqplot and report back.

martinRenou avatar Sep 07 '20 13:09 martinRenou

It looks like jupyterlab build fails during the dependency deduplication, the error message is empty though. I wonder if updating yarn to the latest version could help.

martinRenou avatar Sep 07 '20 13:09 martinRenou

It cannot harm adding it to the README indeed, would you like to open a PR?

I can do that.

And we actually need both options to False?

I don't know. And I don't really understand the effect of these options.

paugier avatar Sep 08 '20 06:09 paugier

One bad thing with long instructions in postBuild is that they do not seem to be cached. So it seems that they slow down a lot the launching of MyBinder. Do you confirm? Could there be a solution to decrease this launching time?

paugier avatar Sep 08 '20 06:09 paugier

I don't know. And I don't really understand the effect of these options.

I suspect the minimizing fails, that's why disabling it fixes the issue.

One bad thing with long instructions in postBuild is that they do not seem to be cached. So it seems that they slow down a lot the launching of MyBinder.

That's odd. Maybe the image is too big so Binder does not save it?

Could there be a solution to decrease this launching time?

If you use Jupyter Notebook instead of JupyterLab, yes. JupyterLab 3.0 should come with a more dynamic plugin system, which means we should not need to re-build JupyterLab everytime we install a single plugin.

You could put everything in one line to decrease the build time, but it will still be quite slow.

jupyter labextension install @jupyter-widgets/jupyterlab-manager jupyter-matplotlib --dev-build=False --minimize=False

martinRenou avatar Sep 08 '20 06:09 martinRenou

I've just tried in one line and without --dev-build=False. It is indeed faster and there is no error. Thanks.

If you use Jupyter Notebook instead of JupyterLab, yes.

Anyway, for Voila, I need to run the jupyter labextension install line?

JupyterLab 3.0 should come with a more dynamic plugin system, which means we should not need to re-build JupyterLab everytime we install a single plugin.

Very good news!!

paugier avatar Sep 08 '20 07:09 paugier

Anyway, for Voila, I need to run the jupyter labextension install line?

No, Voila uses a dynamic plugin system :)

It either downloads the extension online from npmjs, or it uses the nbextension if you use the --enable_nbextensions=True option. The nbextension should be installed automatically using pip install or conda install. But it does not use the labextension so no need for installing it.

martinRenou avatar Sep 08 '20 08:09 martinRenou

Now, I use voilà and jupyter-notebook without postBuild for https://github.com/paugier/plot-covid19. It builds and it's quite fast! Great!

I guess I could even use a requirements.txt instead of environment.yml to get a faster build...

paugier avatar Sep 15 '20 07:09 paugier

You could even host your app on heroku, no build required anymore ;)

martinRenou avatar Sep 15 '20 07:09 martinRenou

https://github.com/voila-dashboards/voila-heroku

martinRenou avatar Sep 15 '20 07:09 martinRenou

The demo is here: https://voila-heroku-demo.herokuapp.com/

The server is took down if not used for ~10 minutes I think (because I use a free account), if the server is down it takes a few seconds to start it again, but once started it's instantaneous to serve a new page.

martinRenou avatar Sep 15 '20 07:09 martinRenou