holzschu / a-shell

A terminal for iOS, with multiple windows
BSD 3-Clause "New" or "Revised" License
2.5k stars 112 forks source link

graphviz dot command not found #435

Open Emasoft opened 1 year ago

Emasoft commented 1 year ago

I got trouble with the graphviz python library. Apparently graphviz should be already included in a-Shell. When I try to install it, it says 'Requirements already satisfied'. But when I try to use the main command line tool of graphviz, 'dot', it says that it does't find it. I even installed pydot separately, but the result is the same.

[~cloud]$ 
[~cloud]$ pip -v install graphviz
Using pip 22.2 from /var/mobile/Containers/Data/Application/A5D5544D-8985-43D8-A812-B241A1D0BD6B/Library/lib/python3.9/site-packages/pip (python 3.9)
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: graphviz in /private/var/mobile/Containers/Data/Application/A5D5544D-8985-43D8-A812-B241A1D0BD6B/Library/lib/python3.9/site-packages (0.20.1
)
[~cloud]$ 
[~cloud]$ dot --help
dot: command not found
[~cloud]$ python dot
python3: can't open file '/private/var/mobile/Library/Mobile Documents/iCloud~AsheKube~app~a-Shell/Documents/dot': [Errno 2] No such file or directory
[~cloud]$ python dot.py
python3: can't open file '/private/var/mobile/Library/Mobile Documents/iCloud~AsheKube~app~a-Shell/Documents/dot.py': [Errno 2] No such file or directory
[~cloud]$ python -m dot.py
/private/var/containers/Bundle/Application/38DB70EF-E2C8-431C-BCDA-60CA2AB58FF3/a-Shell-mini.app/Library/bin/python3: Error while finding module specification for 'dot.py'
 (ModuleNotFoundError: No module named 'dot'). Try using 'dot' instead of 'dot.py' as the module name.
[~cloud]$ python -m dot
/private/var/containers/Bundle/Application/38DB70EF-E2C8-431C-BCDA-60CA2AB58FF3/a-Shell-mini.app/Library/bin/python3: No module named dot
[~cloud]$ 
[~cloud]$ pip -v install pydot
Using pip 22.2 from /var/mobile/Containers/Data/Application/A5D5544D-8985-43D8-A812-B241A1D0BD6B/Library/lib/python3.9/site-packages/pip (python 3.9)
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pydot in /private/var/mobile/Containers/Data/Application/A5D5544D-8985-43D8-A812-B241A1D0BD6B/Library/lib/python3.9/site-packages (1.4.2)
Requirement already satisfied: pyparsing>=2.1.4 in /private/var/containers/Bundle/Application/38DB70EF-E2C8-431C-BCDA-60CA2AB58FF3/a-Shell-mini.app/Library/lib/python3.9/s
ite-packages (from pydot) (3.0.9)
[~cloud]$ 
[~cloud]$ dot
dot: command not found
[~cloud]$ python -m dot
/private/var/containers/Bundle/Application/38DB70EF-E2C8-431C-BCDA-60CA2AB58FF3/a-Shell-mini.app/Library/bin/python3: No module named dot
[~cloud]$ 

Even if I try to use graphviz in my code as a library, it gives me this error:

[~cloud]$ python example_diagram.py
Traceback (most recent call last):
  File "/var/mobile/Containers/Data/Application/A5D5544D-8985-43D8-A812-B241A1D0BD6B/Library/lib/python3.9/site-packages/graphviz/backend/execute.py", line 91, in run_check
    proc.check_returncode()
  File "/private/var/containers/Bundle/Application/38DB70EF-E2C8-431C-BCDA-60CA2AB58FF3/a-Shell-mini.app/Library/lib/python3.9/subprocess.py", line 460, in check_returncode
    raise CalledProcessError(self.returncode, self.args, self.stdout,
subprocess.CalledProcessError: Command '[PosixPath('dot'), '-Kdot', '-Tsvg', '-O', 'advanced_web_service_with_on-premise_(colored)']' returned non-zero exit status 127.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/private/var/mobile/Library/Mobile Documents/iCloud~AsheKube~app~a-Shell/Documents/example_diagram.py", line 36, in <module>
    ingress >> Edge(color="darkgreen") << grpcsvc >> Edge(color="darkorange") >> aggregator
  File "/var/mobile/Containers/Data/Application/A5D5544D-8985-43D8-A812-B241A1D0BD6B/Library/lib/python3.9/site-packages/diagrams/__init__.py", line 154, in __exit__
    self.render()
  File "/var/mobile/Containers/Data/Application/A5D5544D-8985-43D8-A812-B241A1D0BD6B/Library/lib/python3.9/site-packages/diagrams/__init__.py", line 188, in render
    self.dot.render(format=self.outformat, view=self.show, quiet=True)
  File "/var/mobile/Containers/Data/Application/A5D5544D-8985-43D8-A812-B241A1D0BD6B/Library/lib/python3.9/site-packages/graphviz/_tools.py", line 171, in wrapper
    return func(*args, **kwargs)
  File "/var/mobile/Containers/Data/Application/A5D5544D-8985-43D8-A812-B241A1D0BD6B/Library/lib/python3.9/site-packages/graphviz/rendering.py", line 122, in render
    rendered = self._render(*args, **kwargs)
  File "/var/mobile/Containers/Data/Application/A5D5544D-8985-43D8-A812-B241A1D0BD6B/Library/lib/python3.9/site-packages/graphviz/_tools.py", line 171, in wrapper
    return func(*args, **kwargs)
  File "/var/mobile/Containers/Data/Application/A5D5544D-8985-43D8-A812-B241A1D0BD6B/Library/lib/python3.9/site-packages/graphviz/backend/rendering.py", line 324, in render
    execute.run_check(cmd,
  File "/var/mobile/Containers/Data/Application/A5D5544D-8985-43D8-A812-B241A1D0BD6B/Library/lib/python3.9/site-packages/graphviz/backend/execute.py", line 93, in run_check
    raise CalledProcessError(*e.args)
graphviz.backend.execute.CalledProcessError: Command '[PosixPath('dot'), '-Kdot', '-Tsvg', '-O', 'advanced_web_service_with_on-premise_(colored)']' returned non-zero exit 
status 127. [stderr: b'dot: command not found\n']
[~cloud]$ 

Any clue?

holzschu commented 1 year ago

It's probably the same issue as: https://github.com/holzschu/Carnets/issues/164 pip install graphviz works, in the sense that it installs the python package graphviz; but the python package uses the graphviz commands (such as dot) and these are not installed (they cannot be installed, since there are no compilers on iOS).

Emasoft commented 1 year ago

I see. That is a pity. Graphviz is a very useful lib. What about WASM? I don't know anything about WASM, but I understand that it should be possible to compile graphviz in wasm. I found these examples: https://www.npmjs.com/package/@hpcc-js/wasm https://github.com/fabiospampinato/graphviz-wasm https://github.com/JosephusPaye/node-graphviz I'm not sure that the above include the dot tool. Is there any hope to run a WASM version of the dot command in a-Shell?