Unable to reproduce the Binder example for using conda env

I cannot reproduce the Binder repo example for using conda environments with binder: GitHub - binder-examples/conda: Specifying a conda environment with `environment.yml`.
More specifically, when I click on the binder link, the Binder repo launches and the notebook index.ipynb runs without problem.
However, when I forked the Github repo and built it using Binder, I obtain the following Binder: Binder, and the first cell of the index.ipynb notebook returns the error: ImportError: cannot import name '_imaging'.
Any idea why this would be the case?
Best regards,

It’s not you. There is currently a problem with Pillow messing up or a version mismatch going on with what conda has and matplotlib. Do you need this particular example to work right now? The point is that you may use conda to build the stuff you need and not encounter this problem.

The version in the binder example repo still works without seeing that error because the Docker images backing what you get when you click on the example launch button were built before this issue crept into versions that conda has.

If you need this example to work from your forked repo, I’ve put the work-around below the line.


  1. Click the link here to launch using your repo. (Note that my link will insure you don’t hit a memory issue when you run the last code cell. You can do as you were doing before to launch and the work-around will work to allow %matplotlib inline to work; in other words, my special link is only important if you care about the last cell working. I personally question the current demo because I find it exceeds memory needs on most default sessions launched via MyBinder and the last code cell, ‘Compute and plot a cumulative sum’, fails.)

  2. At the very top of the notebook (or at least above the first code cell), and a new cell and run the code below, based on here before running an of the rest of the notebook:

%pip install --upgrade --force-reinstall pillow
  1. Now run the rest of the notebook.

Thank you very much, the work-around you gave worked for me.

1 Like