arun1729 / cog

Micro Graph Database for Python Applications
http://cogdb.io
MIT License
294 stars 22 forks source link

render() throws error #22

Open mgierdal opened 3 years ago

mgierdal commented 3 years ago

Environment: Python 3.8.9 (default, Apr 21 2021, 23:14:29) [GCC 10.2.0] on cygwin cogdb==2.0.5 xxhash==2.0.0

Issue: When running your introductory example from the main page of https://cogdb.io/ (in a jupyter notebook), the following error was thrown:


OSError Traceback (most recent call last)

in 14 g.put("greg","status","cool_person") 15 ---> 16 g.v().tag("from").out("follows").tag("to").view("follows").render() /usr/local/lib/python3.8/site-packages/cog/torque.py in render(self) 324 iframe_html = r""" """.format(self.html) 325 from IPython.core.display import display, HTML --> 326 display(HTML(iframe_html)) 327 328 def persist(self): /usr/lib/python3.8/site-packages/IPython/core/display.py in __init__(self, data, url, filename, metadata) 716 if warn(): 717 warnings.warn("Consider using IPython.display.IFrame instead") --> 718 super(HTML, self).__init__(data=data, url=url, filename=filename, metadata=metadata) 719 720 def _repr_html_(self): /usr/lib/python3.8/site-packages/IPython/core/display.py in __init__(self, data, url, filename, metadata) 628 self.metadata = {} 629 --> 630 self.reload() 631 self._check_data() 632 /usr/lib/python3.8/site-packages/IPython/core/display.py in reload(self) 653 """Reload the raw data from file or URL.""" 654 if self.filename is not None: --> 655 with open(self.filename, self._read_flags) as f: 656 self.data = f.read() 657 elif self.url is not None: OSError: [Errno 91] File name too long: ' ' Thanks
arun1729 commented 3 years ago

@mgierdal what OS are you running your Jupyter notebook on? As a side note, currently ‘view()’ is fully supported only Linux and OSX. If you could try using another environment, I suggest Google Colab notebooks (https://colab.research.google.com/).

arun1729 commented 3 years ago

@mgierdal You could also try just returning the result of the graph traversal : g.v().tag("from").out("follows").tag("to").all()

and then visualize it on cogdb.io > visualization tab.

mgierdal commented 3 years ago

@mgierdal what OS are you running your Jupyter notebook on? As a side note, currently only Linux and OSX is supported. If you could try using another environment, I suggest Google Colab notebooks (https://colab.research.google.com/).

It's running on cygwin, which enables Unix-like environment on Windows. It's really very rare to encounter incompatibilities. Effectively cog is NOT running on Windows.

Using Colab notebooks or visualization tab is out of question, unfortunately. While I wasn't to "shoot tanks" with cogdb, I intended to put it to small scale, but serious use.

Out of curiosity, what are the main issues preventing from using it under actual Windows?

arun1729 commented 3 years ago

Using Colab notebooks or visualization tab is out of question, unfortunately. While I wasn't to "shoot tanks" with cogdb, I intended to put it to small scale, but serious use.

It looks like the error occurs when using 'render()' which depends on IPython's display module - perhaps there is some incompatibly. You could still see the visualization without using render. You can get the location of the html view file using this: g.v().tag("from").out("follows").tag("to").view("follows").url

And view the html file containing the graph visualization using a web browser.

arun1729 commented 3 years ago

Out of curiosity, what are the main issues preventing from using it under actual Windows?

@mgierdal There is nothing preventing it from running on Windows but currently there is no testing done in Windows environment. In theory everything should work just fine on Windows in standard Python. The only exception to that is the 'render' function which is meant to display graph visualizations directly in an IPython notebook.