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

Ensure that holoviews imports without any plotting backend #528

Closed
philippjfr opened this issue Mar 2, 2016 · 6 comments
Closed

Ensure that holoviews imports without any plotting backend #528

philippjfr opened this issue Mar 2, 2016 · 6 comments
Assignees
Milestone

Comments

@philippjfr
Copy link
Member

As the title says, HoloViews used to require only a minimal set of packages to import. This is now broken because the __init__.py attempts to import ipython, which in turn requires at least the matplotlib backend to be loaded. We should ensure this either fails gracefully or get rid of this requirement entirely. Additionally we should also ensure that each backend works independently from all the others, allowing bokeh to be used without matplotlib being installed.

@philippjfr philippjfr added this to the 1.4.4 milestone Mar 2, 2016
@jlstevens
Copy link
Contributor

.. which in turn requires at least the matplotlib backend to be loaded

It is worth pointing out that I believe what is happening is that it is expecting a renderer to exist when none has be defined (no plotting backends available).

I've not looked at the code just yet but I think you meant 'at least one backend to be loaded'...unless we've hardcoded matplotlib as the default backend. In that case, the default backend should work by ordering where the first backend in the renderers list is the default.

@philippjfr
Copy link
Member Author

That's one issue but there's more, after resolving that issue I ran into at least two more issues:

  1. Notebook archive requires nbformat (usually shipped with the notebook)
  2. Parser requires pyparsing (usually shipped with matplotlib)

@jlstevens
Copy link
Contributor

Really our ipython extension really means the ipython notebook extension which is why we can assume jinja2 and nbformat. The pyparsing issue we've known about and I do think it is safe to say that most users will have matplotlib (and can easily install pyparsing installed otherwise).

In conclusion, I think those other imports are ok (nbformat and pyparsing) and the main problem is it should be possible to skip matplotlib as long as you are happy to install pyparsing to get the magics working.

@philippjfr
Copy link
Member Author

No, the IPython extension gets loaded as long as you have IPython installed, either we only import it when all the notebook dependencies are available or we make sure that it imports even without those dependencies, which is what I did in #529.

@jlstevens
Copy link
Contributor

The approach in #529 is good but what what we could have done is simply try to import notebook and not IPython as that would automatically ensure the dependencies are satisfied (except for pyparsing).

@philippjfr
Copy link
Member Author

HoloViews now avoids importing the plotting backends until they are requested by the notebook extension. Closing.

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

No branches or pull requests

2 participants