mingrammer / diagrams

:art: Diagram as Code for prototyping cloud system architectures
https://diagrams.mingrammer.com
MIT License
39.86k stars 2.55k forks source link

add instructions to install graphviz #371

Open WaylonWalker opened 4 years ago

WaylonWalker commented 4 years ago

I am using windows with wsl Ubuntu 20.04. I ran pip install diagrams and ran into the error below. After some googling I found that sudo apt install graphviz solved my problem. I did not immediately see this in the install instuctions, It may be good to include if this is a system requirement.

Loving the experience of the library so far. Fantastic job. The api is so innovative yet intuitive.


In [5]: with Diagram("Grouped Workers", show=False, direction="TB"):
   ...:     ELB("lb") >> [`   ...:         EC2("worker1"),
   ...:         EC2("worker2"),
   ...:         EC2("worker3"),
   ...:         EC2("worker4"),
   ...:         EC2("worker5"),
   ...:     ] >> RDS("events")
---------------------------------------------------------------------------
PermissionError                           Traceback (most recent call last)
<ipython-input-5-1baebafb5618> in <module>
      1 with Diagram("Grouped Workers", show=False, direction="TB"):
----> 2     ELB("lb") >> [
      3         EC2("worker1"),
      4         EC2("worker2"),
      5         EC2("worker3"),

~/miniconda3/envs/kedro/lib/python3.8/site-packages/diagrams/__init__.py in __exit__(self, exc_type, exc_value, traceback)
    145
    146     def __exit__(self, exc_type, exc_value, traceback):
--> 147         self.render()
    148         # Remove the graphviz file leaving only the image.
    149         os.remove(self.filename)

~/miniconda3/envs/kedro/lib/python3.8/site-packages/diagrams/__init__.py in render(self)
    187
    188     def render(self) -> None:
--> 189         self.dot.render(format=self.outformat, view=self.show, quiet=True)
    190
    191

~/miniconda3/envs/kedro/lib/python3.8/site-packages/graphviz/files.py in render(self, filename, directory, view, cleanup, format, renderer, formatter, quiet, quiet_view)
    205             format = self._format
    206
--> 207         rendered = backend.render(self._engine, format, filepath,
    208                                   renderer=renderer, formatter=formatter,
    209                                   quiet=quiet)

~/miniconda3/envs/kedro/lib/python3.8/site-packages/graphviz/backend.py in render(engine, format, filepath, renderer, formatter, quiet)
    204     else:
    205         cwd = None
--> 206     run(cmd, capture_output=True, cwd=cwd, check=True, quiet=quiet)
    207     return rendered
    208

~/miniconda3/envs/kedro/lib/python3.8/site-packages/graphviz/backend.py in run(cmd, input, capture_output, check, quiet, **kwargs)
    157
    158     try:
--> 159         proc = subprocess.Popen(cmd, startupinfo=get_startupinfo(), **kwargs)
    160     except OSError as e:
    161         if e.errno == errno.ENOENT:

~/miniconda3/envs/kedro/lib/python3.8/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, text)
    852                             encoding=encoding, errors=errors)
    853
--> 854             self._execute_child(args, executable, preexec_fn, close_fds,
    855                                 pass_fds, cwd, env,
    856                                 startupinfo, creationflags, shell,

~/miniconda3/envs/kedro/lib/python3.8/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)
   1700                     if errno_num != 0:
   1701                         err_msg = os.strerror(errno_num)
-> 1702                     raise child_exception_type(errno_num, err_msg, err_filename)
   1703                 raise child_exception_type(err_msg)
   1704

PermissionError: [Errno 13] Permission denied: 'dot'

In [6]: from diagrams import Cluster, Diagram

In [7]: from diagrams.aws.compute import ECS, EKS, Lambda

In [8]: from diagrams.aws.database import Redshift

In [9]: from diagrams.aws.integration import SQS

In [10]: from diagrams.aws.storage import S3

In [11]:

In [11]: with Diagram("Event Processing", show=False):
    ...:     source = EKS("k8s source")
---------------------------------------------------------------------------
PermissionError                           Traceback (most recent call last)
<ipython-input-11-dc2d5f565688> in <module>
      1 with Diagram("Event Processing", show=False):
----> 2     source = EKS("k8s source")

~/miniconda3/envs/kedro/lib/python3.8/site-packages/diagrams/__init__.py in __exit__(self, exc_type, exc_value, traceback)
    145
    146     def __exit__(self, exc_type, exc_value, traceback):
--> 147         self.render()
    148         # Remove the graphviz file leaving only the image.
    149         os.remove(self.filename)

~/miniconda3/envs/kedro/lib/python3.8/site-packages/diagrams/__init__.py in render(self)
    187
    188     def render(self) -> None:
--> 189         self.dot.render(format=self.outformat, view=self.show, quiet=True)
    190
    191

~/miniconda3/envs/kedro/lib/python3.8/site-packages/graphviz/files.py in render(self, filename, directory, view, cleanup, format, renderer, formatter, quiet, quiet_view)
    205             format = self._format
    206
--> 207         rendered = backend.render(self._engine, format, filepath,
    208                                   renderer=renderer, formatter=formatter,
    209                                   quiet=quiet)

~/miniconda3/envs/kedro/lib/python3.8/site-packages/graphviz/backend.py in render(engine, format, filepath, renderer, formatter, quiet)
    204     else:
    205         cwd = None
--> 206     run(cmd, capture_output=True, cwd=cwd, check=True, quiet=quiet)
    207     return rendered
    208

~/miniconda3/envs/kedro/lib/python3.8/site-packages/graphviz/backend.py in run(cmd, input, capture_output, check, quiet, **kwargs)
    157
    158     try:
--> 159         proc = subprocess.Popen(cmd, startupinfo=get_startupinfo(), **kwargs)
    160     except OSError as e:
    161         if e.errno == errno.ENOENT:

~/miniconda3/envs/kedro/lib/python3.8/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, text)
    852                             encoding=encoding, errors=errors)
    853
--> 854             self._execute_child(args, executable, preexec_fn, close_fds,
    855                                 pass_fds, cwd, env,
    856                                 startupinfo, creationflags, shell,

~/miniconda3/envs/kedro/lib/python3.8/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)
   1700                     if errno_num != 0:
   1701                         err_msg = os.strerror(errno_num)
-> 1702                     raise child_exception_type(errno_num, err_msg, err_filename)
   1703                 raise child_exception_type(err_msg)
   1704

PermissionError: [Errno 13] Permission denied: 'dot'
dmcken commented 3 years ago

Hi, not the maintainer but in the following locations:

They both mention you need to install Graphviz and point over to the actual graphviz project which gives install instructions for various OSes. Is there another page you got install directions from that needs to be updated?