Skip to content

ModuleNotFoundError: No module named 'plotly.validators.surface' #3998

Closed
@chanansh

Description

@chanansh

pandas: 1.5.2
plotly: 5.11.0
python: 3.10.6
os: centos 7

import pandas as pd
pd.options.plotting.backend = "plotly"
pd.DataFrame({'x':[1,2,3], 'y':[1,2,3]}).plot()

results in

ModuleNotFoundError: No module named 'plotly.validators.surface' 3998


ModuleNotFoundError Traceback (most recent call last)
Cell In[10], line 1
----> 1 pd.DataFrame({'x':[1,2,3], 'y':[1,2,3]}).plot()

File ~/.pyenv/versions/3.10.6/lib/python3.10/site-packages/pandas/plotting/_core.py:930, in PlotAccessor.call(self, *args, **kwargs)
928 # when using another backend, get out of the way
929 if plot_backend.name != "pandas.plotting._matplotlib":
--> 930 return plot_backend.plot(self._parent, x=x, y=y, kind=kind, **kwargs)
932 if kind not in self._all_kinds:
933 raise ValueError(f"{kind} is not a valid plot kind")

File ~/.pyenv/versions/3.10.6/lib/python3.10/site-packages/plotly/init.py:103, in plot(data_frame, kind, **kwargs)
101 return scatter(data_frame, **new_kwargs)
102 if kind == "line":
--> 103 return line(data_frame, **kwargs)
104 if kind == "area":
105 return area(data_frame, **kwargs)

File ~/.pyenv/versions/3.10.6/lib/python3.10/site-packages/plotly/express/_chart_types.py:264, in line(data_frame, x, y, line_group, color, line_dash, symbol, hover_name, hover_data, custom_data, text, facet_row, facet_col, facet_col_wrap, facet_row_spacing, facet_col_spacing, error_x, error_x_minus, error_y, error_y_minus, animation_frame, animation_group, category_orders, labels, orientation, color_discrete_sequence, color_discrete_map, line_dash_sequence, line_dash_map, symbol_sequence, symbol_map, markers, log_x, log_y, range_x, range_y, line_shape, render_mode, title, template, width, height)
216 def line(
217 data_frame=None,
218 x=None,
(...)
258 height=None,
259 ) -> go.Figure:
260 """
261 In a 2D line plot, each row of data_frame is represented as vertex of
262 a polyline mark in 2D space.
263 """
--> 264 return make_figure(args=locals(), constructor=go.Scatter)

File ~/.pyenv/versions/3.10.6/lib/python3.10/site-packages/plotly/express/_core.py:2249, in make_figure(args, constructor, trace_patch, layout_patch)
2247 fig.update_layout(layout_patch)
2248 if "template" in args and args["template"] is not None:
-> 2249 fig.update_layout(template=args["template"], overwrite=True)
2250 for f in frame_list:
2251 f["name"] = str(f["name"])

File ~/.pyenv/versions/3.10.6/lib/python3.10/site-packages/plotly/graph_objs/_figure.py:762, in Figure.update_layout(self, dict1, overwrite, **kwargs)
736 def update_layout(self, dict1=None, overwrite=False, **kwargs) -> "Figure":
737 """
738
739 Update the properties of the figure's layout with a dict and/or with
(...)
760
761 """
--> 762 return super(Figure, self).update_layout(dict1, overwrite, **kwargs)

File ~/.pyenv/versions/3.10.6/lib/python3.10/site-packages/plotly/basedatatypes.py:1401, in BaseFigure.update_layout(self, dict1, overwrite, **kwargs)
1377 def update_layout(self, dict1=None, overwrite=False, **kwargs):
1378 """
1379 Update the properties of the figure's layout with a dict and/or with
1380 keyword arguments.
(...)
1399 The Figure object that the update_layout method was called on
1400 """
-> 1401 self.layout.update(dict1, overwrite=overwrite, **kwargs)
1402 return self

File ~/.pyenv/versions/3.10.6/lib/python3.10/site-packages/plotly/basedatatypes.py:5122, in BasePlotlyType.update(self, dict1, overwrite, **kwargs)
5120 with self.figure.batch_update():
5121 BaseFigure._perform_update(self, dict1, overwrite=overwrite)
-> 5122 BaseFigure._perform_update(self, kwargs, overwrite=overwrite)
5123 else:
5124 BaseFigure._perform_update(self, dict1, overwrite=overwrite)

File ~/.pyenv/versions/3.10.6/lib/python3.10/site-packages/plotly/basedatatypes.py:3899, in BaseFigure._perform_update(plotly_obj, update_obj, overwrite)
3895 val = update_obj[key]
3897 if overwrite:
3898 # Don't recurse and assign property as-is
-> 3899 plotly_obj[key] = val
3900 continue
3902 validator = plotly_obj._get_prop_validator(key)

File ~/.pyenv/versions/3.10.6/lib/python3.10/site-packages/plotly/basedatatypes.py:5861, in BaseLayoutType.setitem(self, prop, value)
5858 match = self._subplot_re_match(prop)
5859 if match is None:
5860 # Set as ordinary property
-> 5861 super(BaseLayoutHierarchyType, self).setitem(prop, value)
5862 else:
5863 # Set as subplotid property
5864 self._set_subplotid_prop(prop, value)

File ~/.pyenv/versions/3.10.6/lib/python3.10/site-packages/plotly/basedatatypes.py:4851, in BasePlotlyType.setitem(self, prop, value)
4849 # ### Handle compound property ###
4850 if isinstance(validator, CompoundValidator):
-> 4851 self._set_compound_prop(prop, value)
4853 # ### Handle compound array property ###
4854 elif isinstance(validator, (CompoundArrayValidator, BaseDataValidator)):

File ~/.pyenv/versions/3.10.6/lib/python3.10/site-packages/plotly/basedatatypes.py:5262, in BasePlotlyType._set_compound_prop(self, prop, val)
5259 # Import value
5260 # ------------
5261 validator = self._get_validator(prop)
-> 5262 val = validator.validate_coerce(val, skip_invalid=self._skip_invalid)
5264 # Save deep copies of current and new states
5265 # ------------------------------------------
5266 curr_val = self._compound_props.get(prop, None)

File ~/.pyenv/versions/3.10.6/lib/python3.10/site-packages/_plotly_utils/basevalidators.py:2748, in BaseTemplateValidator.validate_coerce(self, v, skip_invalid)
2742 if v == {} or isinstance(v, self.data_class) and v.to_plotly_json() == {}:
2743 # Replace empty template with {'data': {'scatter': [{}]}} so that we can
2744 # tell the difference between an un-initialized template and a template
2745 # explicitly set to empty.
2746 return self.data_class(data_scatter=[{}])
-> 2748 return super(BaseTemplateValidator, self).validate_coerce(
2749 v, skip_invalid=skip_invalid
2750 )

File ~/.pyenv/versions/3.10.6/lib/python3.10/site-packages/_plotly_utils/basevalidators.py:2459, in CompoundValidator.validate_coerce(self, v, skip_invalid, _validate)
2455 v = self.data_class(v, skip_invalid=skip_invalid, _validate=_validate)
2457 elif isinstance(v, self.data_class):
2458 # Copy object
-> 2459 v = self.data_class(v)
2460 else:
2461 if skip_invalid:

File ~/.pyenv/versions/3.10.6/lib/python3.10/site-packages/plotly/graph_objs/layout/_template.py:323, in Template.init(self, arg, data, layout, **kwargs)
321 _v = data if data is not None else _v
322 if _v is not None:
--> 323 self["data"] = _v
324 _v = arg.pop("layout", None)
325 _v = layout if layout is not None else _v

File ~/.pyenv/versions/3.10.6/lib/python3.10/site-packages/plotly/basedatatypes.py:4851, in BasePlotlyType.setitem(self, prop, value)
4849 # ### Handle compound property ###
4850 if isinstance(validator, CompoundValidator):
-> 4851 self._set_compound_prop(prop, value)
4853 # ### Handle compound array property ###
4854 elif isinstance(validator, (CompoundArrayValidator, BaseDataValidator)):

File ~/.pyenv/versions/3.10.6/lib/python3.10/site-packages/plotly/basedatatypes.py:5262, in BasePlotlyType._set_compound_prop(self, prop, val)
5259 # Import value
5260 # ------------
5261 validator = self._get_validator(prop)
-> 5262 val = validator.validate_coerce(val, skip_invalid=self._skip_invalid)
5264 # Save deep copies of current and new states
5265 # ------------------------------------------
5266 curr_val = self._compound_props.get(prop, None)

File ~/.pyenv/versions/3.10.6/lib/python3.10/site-packages/_plotly_utils/basevalidators.py:2455, in CompoundValidator.validate_coerce(self, v, skip_invalid, _validate)
2452 v = self.data_class()
2454 elif isinstance(v, dict):
-> 2455 v = self.data_class(v, skip_invalid=skip_invalid, _validate=_validate)
2457 elif isinstance(v, self.data_class):
2458 # Copy object
2459 v = self.data_class(v)

File ~/.pyenv/versions/3.10.6/lib/python3.10/site-packages/plotly/graph_objs/layout/template/_data.py:1732, in Data.init(self, arg, barpolar, bar, box, candlestick, carpet, choroplethmapbox, choropleth, cone, contourcarpet, contour, densitymapbox, funnelarea, funnel, heatmapgl, heatmap, histogram2dcontour, histogram2d, histogram, icicle, image, indicator, isosurface, mesh3d, ohlc, parcats, parcoords, pie, pointcloud, sankey, scatter3d, scattercarpet, scattergeo, scattergl, scattermapbox, scatterpolargl, scatterpolar, scatter, scattersmith, scatterternary, splom, streamtube, sunburst, surface, table, treemap, violin, volume, waterfall, **kwargs)
1730 _v = surface if surface is not None else _v
1731 if _v is not None:
-> 1732 self["surface"] = _v
1733 _v = arg.pop("table", None)
1734 _v = table if table is not None else _v

File ~/.pyenv/versions/3.10.6/lib/python3.10/site-packages/plotly/basedatatypes.py:4855, in BasePlotlyType.setitem(self, prop, value)
4853 # ### Handle compound array property ###
4854 elif isinstance(validator, (CompoundArrayValidator, BaseDataValidator)):
-> 4855 self._set_array_prop(prop, value)
4857 # ### Handle simple property ###
4858 else:
4859 self._set_prop(prop, value)

File ~/.pyenv/versions/3.10.6/lib/python3.10/site-packages/plotly/basedatatypes.py:5336, in BasePlotlyType._set_array_prop(self, prop, val)
5333 # Import value
5334 # ------------
5335 validator = self._get_validator(prop)
-> 5336 val = validator.validate_coerce(val, skip_invalid=self._skip_invalid)
5338 # Save deep copies of current and new states
5339 # ------------------------------------------
5340 curr_val = self._compound_array_props.get(prop, None)

File ~/.pyenv/versions/3.10.6/lib/python3.10/site-packages/_plotly_utils/basevalidators.py:2547, in CompoundArrayValidator.validate_coerce(self, v, skip_invalid)
2545 res.append(self.data_class(v_el))
2546 elif isinstance(v_el, dict):
-> 2547 res.append(self.data_class(v_el, skip_invalid=skip_invalid))
2548 else:
2549 if skip_invalid:

File ~/.pyenv/versions/3.10.6/lib/python3.10/site-packages/plotly/graph_objs/_surface.py:2535, in Surface.init(self, arg, autocolorscale, cauto, cmax, cmid, cmin, coloraxis, colorbar, colorscale, connectgaps, contours, customdata, customdatasrc, hidesurface, hoverinfo, hoverinfosrc, hoverlabel, hovertemplate, hovertemplatesrc, hovertext, hovertextsrc, ids, idssrc, legendgroup, legendgrouptitle, legendrank, legendwidth, lighting, lightposition, meta, metasrc, name, opacity, opacityscale, reversescale, scene, showlegend, showscale, stream, surfacecolor, surfacecolorsrc, text, textsrc, uid, uirevision, visible, x, xcalendar, xhoverformat, xsrc, y, ycalendar, yhoverformat, ysrc, z, zcalendar, zhoverformat, zsrc, **kwargs)
2533 _v = colorbar if colorbar is not None else _v
2534 if _v is not None:
-> 2535 self["colorbar"] = _v
2536 _v = arg.pop("colorscale", None)
2537 _v = colorscale if colorscale is not None else _v

File ~/.pyenv/versions/3.10.6/lib/python3.10/site-packages/plotly/basedatatypes.py:4847, in BasePlotlyType.setitem(self, prop, value)
4844 self._raise_on_invalid_property_error()(prop)
4846 # ### Get validator for this property ###
-> 4847 validator = self._get_validator(prop)
4849 # ### Handle compound property ###
4850 if isinstance(validator, CompoundValidator):

File ~/.pyenv/versions/3.10.6/lib/python3.10/site-packages/plotly/basedatatypes.py:4329, in BasePlotlyType._get_validator(self, prop)
4326 def _get_validator(self, prop):
4327 from .validator_cache import ValidatorCache
-> 4329 return ValidatorCache.get_validator(self._path_str, prop)

File ~/.pyenv/versions/3.10.6/lib/python3.10/site-packages/plotly/validator_cache.py:29, in ValidatorCache.get_validator(parent_path, prop_name)
26 lookup_name = lookup_name or prop_name
27 class_name = lookup_name.title() + "Validator"
28 validator = getattr(
---> 29 importlib.import_module("plotly.validators." + parent_path),
30 class_name,
31 )(plotly_name=prop_name)
32 ValidatorCache._cache[key] = validator
34 return ValidatorCache._cache[key]

File ~/.pyenv/versions/3.10.6/lib/python3.10/importlib/init.py:126, in import_module(name, package)
124 break
125 level += 1
--> 126 return _bootstrap._gcd_import(name[level:], package, level)

File :1050, in _gcd_import(name, package, level)

File :1027, in find_and_load(name, import)

File :1004, in find_and_load_unlocked(name, import)

ModuleNotFoundError: No module named 'plotly.validators.surface'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions