meyer-lab / DDMC

Clusters phosphoproteomics data based on a combination of the sequence information and abundance changes over conditions.
https://asmlab.org
1 stars 1 forks source link

EOFError when trying to use plotly, jupyterlab v2.0 issue? #102

Closed mcreixell closed 4 years ago

mcreixell commented 4 years ago

When trying to run plotpca_ScoresLoadings_plotly (figure1.py), I'm getting the error below. I didn't change anything to this function (that I'm aware of) and I'm not familiar with this error at all. I was thinking that this may have something to do with the recent upgrade of jupyterlab to v2.0? This is not urgent so whenever you get a chance works great. Thanks.

`--------------------------------------------------------------------------- EOFError Traceback (most recent call last)

in ----> 1 plotpca_ScoresLoadings_plotly(d1.T, "AXLmuts + AF154 BR1", "AXL") ~/resistance-MS/msresist/figures/figure1.py in plotpca_ScoresLoadings_plotly(data, title, loc) 309 print(loadings.loc[loc]) 310 --> 311 fig = make_subplots(rows=1, cols=2, subplot_titles=("PCA Scores", "PCA Loadings")) 312 fig.add_trace( 313 go.Scatter( /usr/local/lib/python3.7/dist-packages/plotly/subplots.py in make_subplots(rows, cols, shared_xaxes, shared_yaxes, start_cell, print_grid, horizontal_spacing, vertical_spacing, subplot_titles, column_widths, row_heights, specs, insets, column_titles, row_titles, x_title, y_title, **kwargs) 810 811 # Build resulting figure --> 812 fig = go.Figure(layout=layout) 813 814 # Attach subplot grid info to the figure /usr/local/lib/python3.7/dist-packages/plotly/graph_objs/_figure.py in __init__(self, data, layout, frames, skip_invalid, **kwargs) 609 is invalid AND skip_invalid is False 610 """ --> 611 super(Figure, self).__init__(data, layout, frames, skip_invalid, **kwargs) 612 613 def add_area( /usr/local/lib/python3.7/dist-packages/plotly/basedatatypes.py in __init__(self, data, layout_plotly, frames, skip_invalid, **kwargs) 268 # -------- 269 # ### Check for default template ### --> 270 self._initialize_layout_template() 271 272 # Process kwargs /usr/local/lib/python3.7/dist-packages/plotly/basedatatypes.py in _initialize_layout_template(self) 1948 if self._layout_obj.template is None: 1949 if pio.templates.default is not None: -> 1950 self._layout_obj.template = pio.templates.default 1951 else: 1952 self._layout_obj.template = None /usr/local/lib/python3.7/dist-packages/plotly/basedatatypes.py in __setattr__(self, prop, value) 4449 if match is None: 4450 # Set as ordinary property -> 4451 super(BaseLayoutHierarchyType, self).__setattr__(prop, value) 4452 else: 4453 # Set as subplotid property /usr/local/lib/python3.7/dist-packages/plotly/basedatatypes.py in __setattr__(self, prop, value) 3514 if prop.startswith("_") or hasattr(self, prop) or prop in self._validators: 3515 # Let known properties and private properties through -> 3516 super(BasePlotlyType, self).__setattr__(prop, value) 3517 else: 3518 # Raise error on unknown public properties /usr/local/lib/python3.7/dist-packages/plotly/graph_objs/__init__.py in template(self, val) 96981 @template.setter 96982 def template(self, val): > 96983 self["template"] = val 96984 96985 # ternary /usr/local/lib/python3.7/dist-packages/plotly/basedatatypes.py in __setitem__(self, prop, value) 4435 if match is None: 4436 # Set as ordinary property -> 4437 super(BaseLayoutHierarchyType, self).__setitem__(prop, value) 4438 else: 4439 # Set as subplotid property /usr/local/lib/python3.7/dist-packages/plotly/basedatatypes.py in __setitem__(self, prop, value) 3480 # ### Handle compound property ### 3481 if isinstance(validator, CompoundValidator): -> 3482 self._set_compound_prop(prop, value) 3483 3484 # ### Handle compound array property ### /usr/local/lib/python3.7/dist-packages/plotly/basedatatypes.py in _set_compound_prop(self, prop, val) 3834 # ------------ 3835 validator = self._validators.get(prop) -> 3836 val = validator.validate_coerce(val, skip_invalid=self._skip_invalid) 3837 3838 # Save deep copies of current and new states /usr/local/lib/python3.7/dist-packages/_plotly_utils/basevalidators.py in validate_coerce(self, v, skip_invalid) 2714 # (could be any hashable object) 2715 if v in pio.templates: -> 2716 return copy.deepcopy(pio.templates[v]) 2717 # Otherwise, if v is a string, check to see if it consists of 2718 # multiple template names joined on '+' characters /usr/local/lib/python3.7/dist-packages/plotly/io/_templates.py in __getitem__(self, item) 89 template_str = pkgutil.get_data("plotly", path).decode("utf-8") 90 template_dict = json.loads(template_str) ---> 91 template = Template(template_dict) 92 93 self._templates[template_name] = template /usr/local/lib/python3.7/dist-packages/plotly/graph_objs/layout/__init__.py in __init__(self, arg, data, layout, **kwargs) 9448 # ---------------------------------- 9449 _v = arg.pop("data", None) -> 9450 self["data"] = data if data is not None else _v 9451 _v = arg.pop("layout", None) 9452 self["layout"] = layout if layout is not None else _v /usr/local/lib/python3.7/dist-packages/plotly/basedatatypes.py in __setitem__(self, prop, value) 3480 # ### Handle compound property ### 3481 if isinstance(validator, CompoundValidator): -> 3482 self._set_compound_prop(prop, value) 3483 3484 # ### Handle compound array property ### /usr/local/lib/python3.7/dist-packages/plotly/basedatatypes.py in _set_compound_prop(self, prop, val) 3834 # ------------ 3835 validator = self._validators.get(prop) -> 3836 val = validator.validate_coerce(val, skip_invalid=self._skip_invalid) 3837 3838 # Save deep copies of current and new states /usr/local/lib/python3.7/dist-packages/_plotly_utils/basevalidators.py in validate_coerce(self, v, skip_invalid) 2442 2443 elif isinstance(v, dict): -> 2444 v = self.data_class(v, skip_invalid=skip_invalid) 2445 2446 elif isinstance(v, self.data_class): /usr/local/lib/python3.7/dist-packages/plotly/graph_objs/layout/template/__init__.py in __init__(self, arg, area, barpolar, bar, box, candlestick, carpet, choroplethmapbox, choropleth, cone, contourcarpet, contour, densitymapbox, funnelarea, funnel, heatmapgl, heatmap, histogram2dcontour, histogram2d, histogram, image, indicator, isosurface, mesh3d, ohlc, parcats, parcoords, pie, pointcloud, sankey, scatter3d, scattercarpet, scattergeo, scattergl, scattermapbox, scatterpolargl, scatterpolar, scatter, scatterternary, splom, streamtube, sunburst, surface, table, treemap, violin, volume, waterfall, **kwargs) 1595 self["scattergeo"] = scattergeo if scattergeo is not None else _v 1596 _v = arg.pop("scattergl", None) -> 1597 self["scattergl"] = scattergl if scattergl is not None else _v 1598 _v = arg.pop("scattermapbox", None) 1599 self["scattermapbox"] = scattermapbox if scattermapbox is not None else _v /usr/local/lib/python3.7/dist-packages/plotly/basedatatypes.py in __setitem__(self, prop, value) 3484 # ### Handle compound array property ### 3485 elif isinstance(validator, (CompoundArrayValidator, BaseDataValidator)): -> 3486 self._set_array_prop(prop, value) 3487 3488 # ### Handle simple property ### /usr/local/lib/python3.7/dist-packages/plotly/basedatatypes.py in _set_array_prop(self, prop, val) 3908 # ------------ 3909 validator = self._validators.get(prop) -> 3910 val = validator.validate_coerce(val, skip_invalid=self._skip_invalid) 3911 3912 # Save deep copies of current and new states /usr/local/lib/python3.7/dist-packages/_plotly_utils/basevalidators.py in validate_coerce(self, v, skip_invalid) 2530 res.append(self.data_class(v_el)) 2531 elif isinstance(v_el, dict): -> 2532 res.append(self.data_class(v_el, skip_invalid=skip_invalid)) 2533 else: 2534 if skip_invalid: /usr/local/lib/python3.7/dist-packages/plotly/graph_objs/__init__.py in __init__(self, arg, connectgaps, customdata, customdatasrc, dx, dy, error_x, error_y, fill, fillcolor, hoverinfo, hoverinfosrc, hoverlabel, hovertemplate, hovertemplatesrc, hovertext, hovertextsrc, ids, idssrc, legendgroup, line, marker, meta, metasrc, mode, name, opacity, selected, selectedpoints, showlegend, stream, text, textfont, textposition, textpositionsrc, textsrc, texttemplate, texttemplatesrc, uid, uirevision, unselected, visible, x, x0, xaxis, xcalendar, xsrc, y, y0, yaxis, ycalendar, ysrc, **kwargs) 28533 # Import validators 28534 # ----------------- > 28535 from plotly.validators import scattergl as v_scattergl 28536 28537 # Initialize validators /usr/lib/python3.7/importlib/_bootstrap.py in _find_and_load(name, import_) /usr/lib/python3.7/importlib/_bootstrap.py in _find_and_load_unlocked(name, import_) /usr/lib/python3.7/importlib/_bootstrap.py in _load_unlocked(spec) /usr/lib/python3.7/importlib/_bootstrap_external.py in exec_module(self, module) /usr/lib/python3.7/importlib/_bootstrap_external.py in get_code(self, fullname) /usr/lib/python3.7/importlib/_bootstrap_external.py in _compile_bytecode(data, name, bytecode_path, source_path) EOFError: marshal data too short`
mcreixell commented 4 years ago

(If you think there must be something wrong with my code let me know and I'll fix it.)

aarmey commented 4 years ago

Make sure you've committed anything you want to keep, then run git reset --hard then git clean -ffdx. I think there's a cache file somewhere causing this. This will clear out any hidden files that aren't committed into git.

mcreixell commented 4 years ago

Solved, thanks.

mcreixell commented 4 years ago

Sorry, still not solved. The error is raised when trying to import from plotly.validators import scattergl as v_scattergl. From what you suggested and this discussion (https://stackoverflow.com/questions/50391941/eoferror-marshal-data-too-short), I think that the file that is causing the EOFerror is this:

/my/locked//usr/local/lib/python3.7/dist-packages/plotly/validators/scattergl/__pycache__

But it is protected and can't remove it.

aarmey commented 4 years ago

I uninstalled and reinstalled plotly. Any better?

mcreixell commented 4 years ago

Yes, thanks!