Search code examples
djangodatabasediagram

I want to visualize the database diagram in django but problem in pygraphviz


I am trying to visualize the database diagram in django.

in Docker file I have:

RUN apt-get install -y python3-dev graphviz libgraphviz-dev RUN apt-get install -y python-pygraphviz pkg-config

and in requirements.txt I have:

django, psycopg2, djangorestframework, PyJWT, gunicorn, channels, django-extensions, graphviz, cGraph, pygraphviz

but I get this error :

Building wheel for pygraphviz (setup.py): started
  Building wheel for pygraphviz (setup.py): finished with status 'error'
  ERROR: Command errored out with exit status 1:
   command: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = ... 
  ----------------------------------------
  ERROR: Failed building wheel for pygraphviz
  Running setup.py clean for pygraphviz
Successfully built cGraph
Failed to build pygraphviz ...    ERROR: Service 'web' failed to build: The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1

any idea about this error?


Solution

  • I think you have the wrong Package, try it with

    docker-compose <-f local.yml> run --rm <containername> pip install graphviz 
    

    Or add it to your requirements:

    graphviz==0.16 or 0.1*
    

    Also change your Dockerfile RUN to:

    RUN pip install -r /requirements/local.txt
    

    dont call every single library.

    Little late but hope that helps, Cheers.