My Qgrid widget is not displaying in Binder, while it is displaying fine in my local Jupyter notebook environment.
I have a repo that I want to run on Binder (binder link in README of repo). On my local system I run a conda environment with python 3.7 and the same packages installed as are listed in the requirements.txtfile. I use Qgrid and widgets to display and interact with a dataframe. This is a snapshot of the notebook running in my local environment:
The combination of widgets and dependencies can require some testing of the options to get the right combination that works to build via MyBinder. One suggestion would be to convert your repo to better match the qgrid demo repo. Your current repo is using requirements.txt to install qgrid. That results in pip installing it. The demonstration repo for qgrid that runs on Binder uses conda for installation. (In fact, a commit message mentions that was done to handle enabling.) You may want to launch that repo and try to test some of your output generating code before you convert over yours. If the other installs seem to work with pip you can continue to use that for installation via the environment.yml by adding a pip sub-category. An example of doing that is here (with ‘official’ example here).
(For anyone who might benefit from this information later, I added the more general approach to enabling an extension in a follow-up below.)
I think the “enabling” thing is that to install a notebook extension you usually need to run a command to tell Jupyter that you want it enabled. Just installing the code isn’t enough. A pip package can’t execute commands as part of the install process. However a conda package can.
However I think I’ve started seeing notebook extensions distributed by pip package and they do “just work”. Am I just imagining that or has someone else seen that as well or knows if a pip package can do something like "run a command at the end of the install process’?
I’m glad @betatim tagged this and the conversation continued because I picked up some more insight. It also was good that he tagged it because I was remiss in not expanding my answer earlier to include the standard approach for activating extensions in binderized repos. In my post above I meant to add as a ‘second suggestion’ that theoretically all that was necessary to make the qgird extension work from the state the repo was currently in at the time @Stephan_Heunis made the original post was two things:
Add jupyter_contrib_nbextensions to requirements.txt
Add jupyter contrib nbextension install --user to the postBuild file above the enabling command that was already there.
These steps are based on the example enabling Jupyter extensions repo among the Binder Examples. I was favoring the way the qgrid developers did things as the ‘first’ suggestion because I thought the path of least resistance was to follow their lead.