LorenFrankLab / spyglass

Neuroscience data analysis framework for reproducible research built by Loren Frank Lab at UCSF
https://lorenfranklab.github.io/spyglass/
MIT License
94 stars 43 forks source link

running `dj.Diagram(sgc.Session) - 1 + 2` requires compatible `pydot` and `networkx` libraries #1118

Closed donghoon-shin closed 2 months ago

donghoon-shin commented 2 months ago

Describe the bug A clear and concise description of what the bug is.

I just created a new conda environment with the most recent spyglass version. I ran dj.Diagram(sgc.Session) - 1 + 2 in the 02_Insert_Data.ipynb and found below error. Error was resolved when I reinstalled compatible versions of pydot and networkx by pip install pydot==1.4.2 networkx==2.5.

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
File ~/anaconda3/envs/spyglass/lib/python3.9/site-packages/IPython/core/formatters.py:344, in BaseFormatter.__call__(self, obj)
    342     method = get_real_method(obj, self.print_method)
    343     if method is not None:
--> 344         return method()
    345     return None
    346 else:

File ~/anaconda3/envs/spyglass/lib/python3.9/site-packages/datajoint/diagram.py:440, in Diagram._repr_svg_(self)
    439 def _repr_svg_(self):
--> 440     return self.make_svg()._repr_svg_()

File ~/anaconda3/envs/spyglass/lib/python3.9/site-packages/datajoint/diagram.py:428, in Diagram.make_svg(self)
    425 def make_svg(self):
    426     from IPython.display import SVG
--> 428     return SVG(self.make_dot().create_svg())

File ~/anaconda3/envs/spyglass/lib/python3.9/site-packages/datajoint/diagram.py:371, in Diagram.make_dot(self)
    308 label_props = {  # http://matplotlib.org/examples/color/named_colors.html
    309     None: dict(
    310         shape="circle",
   (...)
    364     ),
    365 }
    366 node_props = {
    367     node: label_props[d["node_type"]]
    368     for node, d in dict(graph.nodes(data=True)).items()
    369 }
--> 371 dot = nx.drawing.nx_pydot.to_pydot(graph)
    372 for node in dot.get_nodes():
    373     node.set_shape("circle")

File ~/anaconda3/envs/spyglass/lib/python3.9/site-packages/networkx/drawing/nx_pydot.py:311, in to_pydot(N)
    300 raise_error = (
    301     _check_colon_quotes(u)
    302     or _check_colon_quotes(v)
   (...)
    308     )
    309 )
    310 if raise_error:
--> 311     raise ValueError(
    312         f'Node names and attributes should not contain ":" unless they are quoted with "".\
    313         For example the string \'attribute:data1\' should be written as \'"attribute:data1"\'.\
    314         Please refer https://github.com/pydot/pydot/issues/258'
    315     )
    316 edge = pydot.Edge(u, v, **str_edgedata)
    317 P.add_edge(edge)

ValueError: Node names and attributes should not contain ":" unless they are quoted with "".                    For example the string 'attribute:data1' should be written as '"attribute:data1"'.                    Please refer https://github.com/pydot/pydot/issues/258

To Reproduce Steps to reproduce the behavior:

  1. This error is on file '....' at file path '....'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error
Error Stack ```python # Paste the error stack trace here ```

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

CBroz1 commented 2 months ago

This is a DataJoint issue resolved last week, and should be fixed by updating to the pre-release of DataJoint via github