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

dask requirement not handled properly (ImportError) #3685

Closed
odoublewen opened this issue May 2, 2019 · 7 comments
Closed

dask requirement not handled properly (ImportError) #3685

odoublewen opened this issue May 2, 2019 · 7 comments
Milestone

Comments

@odoublewen
Copy link

@odoublewen odoublewen commented May 2, 2019

sometime between releases holoviews releases 1.10.9 and 1.12.2., I started getting this import error if dask is in the namespace (in my case, it's being dragged in by scikit-allel).

$ pipenv shell --three
$ pipenv install holoviews dask
$ python -c "import dask; import holoviews as hv; hv.HeatMap({'x':[1], 'y':[1], 'z':[1]})"
Traceback (most recent call last):
  ...
  File "/home/osolberg/temp/holoviews_test/.venv/lib/python3.6/site-packages/holoviews/core/data/interface.py", line 251, in initialize
    raise DataError(error)
holoviews.core.data.interface.DataError: None of the available storage backends were able to support the supplied data format. GridInterface raised following error:

 No module named 'toolz'

Dask array requirements are not installed.

Please either conda or pip install as follows:

  conda install dask                 # either conda install
  pip install dask[array] --upgrade  # or pip install

As the message suggests, I can get around the import error by installing dask[complete]

The same command works if I don't import dask, i.e.:

python -c "import holoviews as hv; hv.HeatMap({'x':[1], 'y':[1], 'z':[1]})"

But this is a problem because I am using scikit-allel which uses dask.

It seems like holoviews doesn't need dask, but if holoviews finds dask in the namespace, then it will throw an error if it's not dask[complete]

This is Python 3.6.5. I can post a full Pipfile.lock if needed, but I think this should be pretty easy to reproduce.

@philippjfr
Copy link
Member

@philippjfr philippjfr commented May 16, 2019

HoloViews does not use toolz directly so this seems like an issue upstream somewhere.

@jbednar
Copy link
Member

@jbednar jbednar commented May 16, 2019

Datashader does, and HoloViews imports Datashader...

@philippjfr
Copy link
Member

@philippjfr philippjfr commented May 16, 2019

@odoublewen
Copy link
Author

@odoublewen odoublewen commented May 16, 2019

The proximal cause is this line

if 'dask' in sys.modules:
        import dask.array as da

But it is not enough to test if 'dask' in sys.modules because dask has several install variants, and the default variant does not provide dask.array.

The simplest solution would be to wrap the above import statement in a try-except....

@philippjfr
Copy link
Member

@philippjfr philippjfr commented May 16, 2019

Thanks @odoublewen, I was not aware of all the install variants.

@odoublewen
Copy link
Author

@odoublewen odoublewen commented May 16, 2019

Ha, you beat me to it! :) I will close my PR

@philippjfr
Copy link
Member

@philippjfr philippjfr commented May 16, 2019

Oh no, I would have preferred an external contribution, sorry about that :-/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants