holoviz / hvplot

A high-level plotting API for pandas, dask, xarray, and networkx built on HoloViews
https://hvplot.holoviz.org
BSD 3-Clause "New" or "Revised" License
1.13k stars 109 forks source link

Cannot import Rectangle or Segments elements from holoviews using hvplot converter #729

Closed Elizabethcase closed 2 years ago

Elizabethcase commented 2 years ago

This might be a holoviews problem but it's showing up under hvplot's converter so putting the issue here to start, let me know if I should submit it elsewhere.

ALL software version info

Using as part of the HIPP image pre-processing package in a Jupyter notebook hvplot-0.7.3 holoview-1.12.7 os - monterey-12.2.1

Description of expected behavior and the observed behavior

expected: hvplot loads holoviews, which loads holoviews.elements.Rectangles and holoviews.elements.Segments

observed: most holoview elements can be imported except for Rectangles and Segments

Complete, minimal, self-contained example code that reproduces the issue

from holoviews.element import Rectangles
from holoviews.element import Segments

^this reproduces the problem but the trace below shows the path - import hvplot --> hv plot loads holoviews -> hvplot/converter.py trieds to load

from holoviews.element import ( 
Curve, Scatter, Area, Bars, BoxWhisker, Dataset, Distribution, Table, HeatMap, Image, HexTiles, QuadMesh, Bivariate, Histogram, Violin, Contours, Polygons, Points, Path, Labels, RGB, ErrorBars, VectorField, Rectangles, Segments

Stack traceback and/or browser JavaScript console output

File ~/Documents/projects/tetons/code/dems/hipp/hipp/tools/tools.py:3, in <module>
          1 import cv2
          2 import holoviews as hv
    ----> 3 import hvplot
          4 import hvplot.xarray
          5 import matplotlib

    File ~/opt/anaconda3/envs/hipp/lib/python3.8/site-packages/hvplot/__init__.py:12, in <module>
          8 import holoviews as _hv
         10 from holoviews import Store
    ---> 12 from .converter import HoloViewsConverter
         13 from .util import get_ipy
         14 from .utilities import save, show # noqa

    File ~/opt/anaconda3/envs/hipp/lib/python3.8/site-packages/hvplot/converter.py:19, in <module>
         17 from holoviews.core.layout import NdLayout
         18 from holoviews.core.util import max_range, basestring
    ---> 19 from holoviews.element import (
         20     Curve, Scatter, Area, Bars, BoxWhisker, Dataset, Distribution,
         21     Table, HeatMap, Image, HexTiles, QuadMesh, Bivariate, Histogram,
         22     Violin, Contours, Polygons, Points, Path, Labels, RGB, ErrorBars,
         23     VectorField, Rectangles, Segments
         24 )
         25 from holoviews.plotting.bokeh import OverlayPlot, colormap_generator
         26 from holoviews.plotting.util import process_cmap

    ImportError: cannot import name 'Rectangles' from 'holoviews.element' (/Users/elizabeth/opt/anaconda3/envs/hipp/lib/python3.8/site-packages/holoviews/element/__init__.py)

Screenshots or screencasts of the bug in action

Elizabethcase commented 2 years ago

To follow up, there's no class defining Rectangles or Segments in holoviews/elements/. Possibly Bounds in elements/paths.py has replaced Rectangles? And if Segments are edge segments, might be handled in elements/utils.py but not as sure about that.

Elizabethcase commented 2 years ago

eh, realized this has to do with the holoviews version not matching hvplot, because of a bokeh dependency on an older version.

geo-jules-cross commented 9 months ago

eh, realized this has to do with the holoviews version not matching hvplot, because of a bokeh dependency on an older version.

I am trying to setup a Conda env to run HIPP and running into this issue.

What versions of bokeh / holoviews / hvplot worked for you? Could you share an environment.yml file?