elegant-scipy / elegant-scipy

1st Edition of Elegant SciPy (O'Reilly Publishers)
Other
553 stars 209 forks source link

Binder notebooks not working, dependency issues #359

Open jni opened 4 years ago

jni commented 4 years ago

The binder notebooks appear to have some library version issues. Running Cell 9 in Chapter 4 gives the following traceback, which I think is related to Dask's implementation of NEP18:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/srv/conda/envs/notebook/lib/python3.6/site-packages/dask/utils.py in wrapper(method)
    674             method.__doc__ = _derived_from(
--> 675                 original_klass, method, ua_args=ua_args, extra=extra
    676             )

/srv/conda/envs/notebook/lib/python3.6/site-packages/dask/utils.py in _derived_from(cls, method, ua_args, extra)
    617     # in the doc
--> 618     original_method = getattr(cls, method.__name__)
    619 

AttributeError: module 'numpy' has no attribute 'divmod'

During handling of the above exception, another exception occurred:

AttributeError                            Traceback (most recent call last)
<ipython-input-9-b59a41e384be> in <module>
----> 1 from skimage import util
      2 
      3 M = 1024
      4 
      5 slices = util.view_as_windows(audio, window_shape=(M,), step=100)

/srv/conda/envs/notebook/lib/python3.6/site-packages/skimage/__init__.py in <module>
    156     except ImportError as e:
    157         _raise_build_error(e)
--> 158     from .util.dtype import *
    159 
    160 

/srv/conda/envs/notebook/lib/python3.6/site-packages/skimage/util/__init__.py in <module>
      3 from .shape import view_as_blocks, view_as_windows
      4 from .noise import random_noise
----> 5 from .apply_parallel import apply_parallel
      6 
      7 from .arraycrop import crop

/srv/conda/envs/notebook/lib/python3.6/site-packages/skimage/util/apply_parallel.py in <module>
      6 
      7 try:
----> 8     import dask.array as da
      9     dask_available = True
     10 except ImportError:

/srv/conda/envs/notebook/lib/python3.6/site-packages/dask/array/__init__.py in <module>
     24     from .tiledb_io import from_tiledb, to_tiledb
     25     from .numpy_compat import rollaxis, moveaxis
---> 26     from .routines import (
     27         take,
     28         choose,

/srv/conda/envs/notebook/lib/python3.6/site-packages/dask/array/routines.py in <module>
     18 from .utils import safe_wraps, validate_axis, meta_from_array, zeros_like_safe
     19 from .wrap import ones
---> 20 from .ufunc import multiply, sqrt
     21 
     22 from .core import (

/srv/conda/envs/notebook/lib/python3.6/site-packages/dask/array/ufunc.py in <module>
    355 
    356 
--> 357 @derived_from(np)
    358 def divmod(x, y):
    359     res1 = x // y

/srv/conda/envs/notebook/lib/python3.6/site-packages/dask/utils.py in wrapper(method)
    678 
    679         except AttributeError:
--> 680             module_name = original_klass.__module__.split(".")[0]
    681 
    682             @functools.wraps(method)

AttributeError: module 'numpy' has no attribute '__module__'
rossbar commented 4 years ago

I see this as well. It looks like Binder builds the environment from the elegant-scipy/notebooks repo - a quick look shows that the requirements.txt and environment.yml are still consistent with elegant-scipy/elegant-scipy before #350 .

I think updating requirements.txt and environment.yml in elegant-scipy/notebooks to be consistent with elegant-scipy/elegant-scipy would do the trick - though then the notebooks themselves would likely have to be updated (e.g. handling the networkx API change a la #348)

jni commented 4 years ago

@rossbar Thanks for chiming in! Yes you are absolutely right. I'm intending to fix this in the coming days, but if you want to submit a PR there, it would be most appreciated of course! The notebooks are created by running notedown without --run.