2

I am using django-extensions to generate a model graph for my Django application.

My installation steps are the following:

$ pip install django-extensions
$ pip install pyparsing pydot

An installation of pygraphviz fails (as described) due to missing C extensions:

$ pip install pygraphviz # this does not work

Now, using the pydot option from the graph_models documentation works for .dot files:

$ python manage.py graph_models -a -I Device,Vehicle -o my_project_subsystem.dot

But creating PNG files breaks and indicates that dot is not on PATH:

$ python manage.py graph_models --pydot -a -g -o my_project_visualized.png

with an error:

FileNotFoundError: [WinError 2] "dot" not found in path

A fix to this problem using conda and pygraphviz is provided in this answer.

But how can I create graphs with only using pip without using anaconda? To me, it does not matter if use pydot or pygraphviz. I just want to create models into PNG files.

Thanks in advance!

Cord Kaldemeyer
  • 6,405
  • 8
  • 51
  • 81
  • Does this answer your question? ["dot.exe" not found in path. Pydot on Python (Windows 7)](https://stackoverflow.com/questions/40632486/dot-exe-not-found-in-path-pydot-on-python-windows-7) – Abdul Aziz Barkat Oct 29 '22 at 16:26

2 Answers2

3

It took a while but I got it working using the following steps:

  1. Install django extensions via $ pip install django-extensions==3.1.5
  2. Install pydotplus via $ pip install pydotplus==2.0.2
  3. Install GraphViz via installer and MANUALLY add it to the user PATH

Include django_extensions in settings.py:

INSTALLED_APPS = (
    ...
    'django_extensions',
    ...
)

Run command:

$ python manage.py graph_models -a -o myapp_models.png

cigien
  • 57,834
  • 11
  • 73
  • 112
Cord Kaldemeyer
  • 6,405
  • 8
  • 51
  • 81
0

You must download and install apllication https://graphviz.org/download/ helped me after fighting all other solutions

h lucas
  • 1
  • 2
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 02 '22 at 04:51