0

Alright, so I installed Anaconda 2.3.2 and run it as admin, then I tried to import the package graphviz, so I installed it with:

conda install -c anaconda graphviz

which is what was recommended in the (official documentation for anaconda)

however, when I tried to import the package with either:

import graphviz

or just a function with

from graphviz import Source

I get the same error:

ModuleNotFoundError: No module named 'graphviz'

I tried installing the package again, but anaconda doesn't seem to recognize it (I'm using a jupyter notebook and everything else runs alright). Is there some other path that it's missing or something?

I tried reinstalling anaconda from scratch, but that didn't work either.

  • Does `pip install graphviz` work? – jjislam Feb 03 '23 at 17:33
  • Not entirely, because I need to use the "dot" command to transform a graph to a png from the command line, and it wasn't working. However, what finally worked was doing a double installation, with "pip install graphviz" and "conda install graphviz"... for some reason that made it work... at last. – JokingReaper Feb 03 '23 at 18:23

2 Answers2

0

I finally got it to work, although it seems a bit cluncky... I had to use a double installation, by using the command

pip install graphviz

It finally started to be recognized, however, I also needed to use the "dot" command from the command line to transform a graph into a png image, and it wasn't being recognized, however, after I made a SECOND installation with:

conda install graphviz

For some reason, that made it work... at last.

  • There are two parts to the Graphviz puzzle, see https://stackoverflow.com/questions/73653801/problem-with-graphviz-executablenotfound-error/73654783#73654783 – sroush Feb 03 '23 at 18:36
0

Since Conda is a generic package manager - not just Python - one needs to distinguish somehow when a package is a Python wrapper versus a library or other compiled binary. In this case, the Python wrapper, which goes by graphviz on PyPI and delivers the graphviz module in Python, goes by python-graphviz on Conda. So, one would use

conda install python-graphviz

to get this. The upside here is that this Conda package lists graphviz as a dependency and so will also install that.

merv
  • 67,214
  • 13
  • 180
  • 245