XifengGuo / CapsNet-Keras

A Keras implementation of CapsNet in NIPS2017 paper "Dynamic Routing Between Capsules". Now test error = 0.34%.
MIT License
2.47k stars 652 forks source link

ImportError: You must install pydot and graphviz for `pydotprint` to work. #25

Closed bukosabino closed 7 years ago

bukosabino commented 7 years ago

When I run capsulenet.py, I have this error:

ImportError: Failed to import pydot. You must install pydot and graphviz for pydotprint to work.

But, I have installed pydot and graphviz: pydot==1.2.3 graphviz==0.8.1

Any idea?

XifengGuo commented 7 years ago

try https://github.com/XifengGuo/CapsNet-Keras/issues/7

bukosabino commented 7 years ago

Solved. I commented the plot_model line.

Thanks you. Good code @XifengGuo

nabsabraham commented 6 years ago

hi @bukosabino, can you tell me what you commented out to get the plot_model to work?

bukosabino commented 6 years ago

hi @brownpanther ,

I think my reply doesn't make sense now because this line is out of current code.

feng1919 commented 5 years ago

hi @bukosabino, can you tell me what you commented out to get the plot_model to work?

I got this to work by "brew install graphviz".

ReneWu1117 commented 5 years ago

sudo apt-get install graphviz

pcko1 commented 5 years ago

pip install graphviz within my conda env solved it for me

p.s. I also tried conda install graphviz but problem persisted

theccalderon commented 5 years ago

hi @bukosabino, can you tell me what you commented out to get the plot_model to work?

I got this to work by "brew install graphviz".

This fixed it for me on my Mac.

swun90 commented 5 years ago

Just in case someone using windows might need it, modify the pydot.py file. It should be in <python_install_path>\Lib\Site-packages\pydot.py. Besides pip install pydot and pip install graphviz, also install graphviz software. And add the software bin directory to the system's path. And in class Dot(Graph), change self.prog = 'dot' to self.prog = 'dot.exe'

Seems that the package was written for *nix system. So in windows, assign it to be an .exe file.

emckenzi123 commented 4 years ago

I was able to get it to work with Tensorflow 2 on Ubuntu with:

pip install pydot
pip install pydotplus
apt-get install graphviz
pip install graphviz
Rahma20 commented 4 years ago

@swun90 Thank you for your solution. It works for me :)

pinxau1000 commented 4 years ago

Just in case someone using windows might need it, modify the pydot.py file. It should be in <python_install_path>\Lib\Site-packages\pydot.py. Besides pip install pydot and pip install graphviz, also install graphviz software. And add the software bin directory to the system's path. And in class Dot(Graph), change self.prog = 'dot' to self.prog = 'dot.exe'

Seems that the package was written for *nix system. So in windows, assign it to be an .exe file.

Also I needed to open CMD with administrator privileges and run dot -c or dot.exe -c.

vganjali commented 3 years ago

Install pydot, graphviz using conda/pip Add a couple of changes in <python_install_path>\Lib\Site-packages\pydot.py as below:

def get_executable_extension():
    # type: () -> str
    if is_windows():
        #return '.bat' if is_anacoda() else '.exe'
        return '.exe'
    else:
        return ''

return.bat didn't exist in Graphviz install directory.

class Dot(Graph):
    """A container for handling a dot language file.

    This class implements methods to write and process
    a dot language file. It is a derived class of
    the base class 'Graph'.
    """

    def __init__(self, *argsl, **argsd):
        Graph.__init__(self, *argsl, **argsd)

        self.shape_files = list()
        self.formats = [
            'canon', 'cmap', 'cmapx',
            'cmapx_np', 'dia', 'dot',
            'fig', 'gd', 'gd2', 'gif',
            'hpgl', 'imap', 'imap_np', 'ismap',
            'jpe', 'jpeg', 'jpg', 'mif',
            'mp', 'pcl', 'pdf', 'pic', 'plain',
            'plain-ext', 'png', 'ps', 'ps2',
            'svg', 'svgz', 'vml', 'vmlz',
            'vrml', 'vtx', 'wbmp', 'xdot', 'xlib']

        #self.prog = 'dot' # Unix
        self.prog = r'C:\Program Files\Graphviz\bin\dot' # Windows absolute path

For some reason subprocess.Popen was not able to find 'dot.exe' from my system (I had Graphviz/bin to the system path variables), used absolute path instead and it worked!

hkhdair commented 2 years ago

conda install graphviz

conda install graphviz solved the problem for me 👍

ghost commented 2 years ago

conda install graphviz
solved the problem for me

Abdelrhman2022 commented 2 years ago

The following commands solved the problem for me

pip install pydot
pip install pydotplus
pip install graphviz