I'm having problems with Anaconda recognizing the package "graphviz", even if it has been installed

162 views Asked by At

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.

2

There are 2 answers

1
JokingReaper On

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.

0
merv On

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.