RedaOps / ann-visualizer

A python library for visualizing Artificial Neural Networks (ANN)
MIT License
1.24k stars 216 forks source link

error on google collaboration (colab.research.google.com) #13

Closed hmd810 closed 6 years ago

hmd810 commented 6 years ago

hi i run test_ann.py on google collaboration but i got this error FileNotFoundError: [Errno 2] No such file or directory: 'xdg-open': 'xdg-open'.

`FileNotFoundError Traceback (most recent call last)

in () 22 from ann_visualizer.visualize import ann_viz; 23 ---> 24 ann_viz(network, title=""); /usr/local/lib/python3.6/dist-packages/ann_visualizer/visualize.py in ann_viz(model, view, filename, title) 204 g.edge_attr.update(arrowhead="none", color="#707070"); 205 if view == True: --> 206 g.view(); /usr/local/lib/python3.6/dist-packages/graphviz/files.py in view(self, filename, directory, cleanup) 201 """ 202 return self.render(filename=filename, directory=directory, view=True, --> 203 cleanup=cleanup) 204 205 def _view(self, filepath, format): /usr/local/lib/python3.6/dist-packages/graphviz/files.py in render(self, filename, directory, view, cleanup) 180 181 if view: --> 182 self._view(rendered, self._format) 183 184 return rendered /usr/local/lib/python3.6/dist-packages/graphviz/files.py in _view(self, filepath, format) 216 raise RuntimeError('%r has no built-in viewer support for %r ' 217 'on %r platform' % (self.__class__, format, backend.PLATFORM)) --> 218 view_method(filepath) 219 220 _view_darwin = staticmethod(backend.view.darwin) /usr/local/lib/python3.6/dist-packages/graphviz/backend.py in view_unixoid(filepath) 226 def view_unixoid(filepath): 227 """Open filepath in the user's preferred application (linux, freebsd).""" --> 228 subprocess.Popen(['xdg-open', filepath]) 229 230 /usr/lib/python3.6/subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors) 707 c2pread, c2pwrite, 708 errread, errwrite, --> 709 restore_signals, start_new_session) 710 except: 711 # Cleanup if the child failed starting. /usr/lib/python3.6/subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session) 1342 if errno_num == errno.ENOENT: 1343 err_msg += ': ' + repr(err_filename) -> 1344 raise child_exception_type(errno_num, err_msg, err_filename) 1345 raise child_exception_type(err_msg) 1346 FileNotFoundError: [Errno 2] No such file or directory: 'xdg-open': 'xdg-open'`
RedaOps commented 6 years ago

Do you have graphviz installed? Look at the .travis.yml file to see all libraries required to run ann_visualizer.

tsyet12 commented 5 years ago

Type this on top of your code: !apt-get install xdg-utils