Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Python] How to properly set-up GraphViz for Mac or Windows? #3692

Closed
jordan-carson opened this issue Jun 13, 2022 · 3 comments
Closed

[Python] How to properly set-up GraphViz for Mac or Windows? #3692

jordan-carson opened this issue Jun 13, 2022 · 3 comments

Comments

@jordan-carson
Copy link

Hello, Polars,

I have asked this question on SO.

Trying to set-up graphviz for df.show_graph() however after adding graphviz and matplotlib locations to my path env var, I receive the follow error.

Traceback (most recent call last):
  File "/Users/jordancarson/Projects/JHU/pract.py", line 24, in <module>
    print(res.show_graph(optimized=True))
  File "/Users/jordancarson/Projects/JHU/.venv/lib/python3.9/site-packages/polars/internals/lazy_frame.py", line 464, in show_graph
    subprocess.run(["dot", "-Nshape=box", "-Tpng", "-O", dot_path])
  File "/opt/homebrew/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 505, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/opt/homebrew/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/opt/homebrew/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 1821, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'dot'

Getting closer, but still no cigar (🚬...).

Any advice or thoughts on how to get this to work? I have tried using Issue GraphViz.

@jordan-carson
Copy link
Author

jordan-carson commented Jun 13, 2022

I have followed this post https://stackoverflow.com/questions/43372723/how-to-open-dot-on-mac - which mentions to use MacPorts to install graphviz via sudo apt install.... The problem here is it installs on a different version of python that I do not use.

@ritchie46
Copy link
Member

The conda package installer can often help a lot with this.

@slonik-az
Copy link
Contributor

If you on Mac M1 try out mamba (faster drop-in conda replacement). Install Graphviz with

mamba install graphviz

and you well get dot and friends installed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants