torch / nngraph

Graph Computation for nn

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

can't get graphviz work on mac

pfllo opened this issue · comments

When I try to use "graph.dot" on mac, it gives following error:

Warning: Could not load "/usr/local/Cellar/graphviz/2.38.0/lib/graphviz/libgvplugin_dot_layout.6.dylib" - file not found
Error: Layout type: "dot" not recognized. Use one of: circo dot fdp neato nop nop1 nop2 osage patchwork sfdp twopi
/Users/luo123n/torch/install/bin/luajit: ...s/luo123n/torch/install/share/lua/5.1/graph/graphviz.lua:135: graphviz layout failed
stack traceback:
    [C]: in function 'assert'
    ...s/luo123n/torch/install/share/lua/5.1/graph/graphviz.lua:135: in function 'graphvizFile'
    ...s/luo123n/torch/install/share/lua/5.1/graph/graphviz.lua:162: in function 'dot'
    test.lua:23: in main chunk
    [C]: in function 'dofile'
    ...123n/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:131: in main chunk
    [C]: at 0x010e387330

I can find similar issues using google, but there seems no solution yet.

I get exactly the same error on two separate Mac's.

I originally thought this might be similar to #59 , but on closer inspection looks like you are missing a dependency of one of the dylibs imported, plausibly a dependency of libgvc.so . It seems that actually this dll is being loaded ok, since you get as far as line 135 of graphviz.lua before crashing, so maybe you have an older version of gvc, or a newer version, or you're missing a plugin called something like 'dot_layout'?

By the way, on linux ubuntu, I have no such plugin/.so, and graphviz works for me. Just in case it is useful, here is some output from a couple of diag commands:

user@pear:~/git/nngraph$ ldd /usr/lib/libgvc.so.6
    linux-vdso.so.1 =>  (0x00007fff5c3dd000)
    libltdl.so.7 => /usr/lib/x86_64-linux-gnu/libltdl.so.7 (0x00007f4af5bb8000)
    libcdt.so.5 => /usr/lib/libcdt.so.5 (0x00007f4af59b1000)
    libcgraph.so.6 => /usr/lib/libcgraph.so.6 (0x00007f4af579a000)
    libpathplan.so.4 => /usr/lib/libpathplan.so.4 (0x00007f4af5592000)
    libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f4af5368000)
    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f4af514e000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f4af4e48000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f4af4a83000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f4af487e000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f4af6082000)
user@pear:~/git/nngraph$ ldd /usr/lib/libcgraph.so.6
    linux-vdso.so.1 =>  (0x00007fff653f9000)
    libcdt.so.5 => /usr/lib/libcdt.so.5 (0x00007f5aedc65000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f5aed8a0000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f5aee0a7000)
user@pear:~/git/nngraph$ ls /usr/lib/*dot*
ls: cannot access /usr/lib/*dot*: No such file or directory
commented

hi
I have the same error.
Did you find a solution ?

But for answer hughperkins :

$ otool -L /usr/local/lib/libgvc.6.dylib
/usr/local/lib/libgvc.6.dylib:
/usr/local/lib/libgvc.6.dylib (compatibility version 7.0.0, current version 7.0.0)
/usr/local/Cellar/graphviz/2.38.0/lib/libxdot.4.dylib (compatibility version 5.0.0, current version 5.0.0)
/usr/local/Cellar/graphviz/2.38.0/lib/libcdt.5.dylib (compatibility version 6.0.0, current version 6.0.0)
/usr/local/Cellar/graphviz/2.38.0/lib/libcgraph.6.dylib (compatibility version 7.0.0, current version 7.0.0)
/usr/local/Cellar/graphviz/2.38.0/lib/libpathplan.4.dylib (compatibility version 5.0.0, current version 5.0.0)
/usr/lib/libexpat.1.dylib (compatibility version 7.0.0, current version 7.2.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)

$ otool -L /usr/local/lib/libcgraph.6.dylib
/usr/local/lib/libcgraph.6.dylib:
/usr/local/lib/libcgraph.6.dylib (compatibility version 7.0.0, current version 7.0.0)
/usr/local/Cellar/graphviz/2.38.0/lib/libcdt.5.dylib (compatibility version 6.0.0, current version 6.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)

So I don't inderstand why it's doesn't works :/

well, to be fair, you really odnt have this file: libgvplugin_dot_layout.6.dylib do you have some way of asking your package manager which package contains this file?

commented

this file is on the path referenced by the error :
/usr/local/Cellar/graphviz/2.38.0/lib/graphviz/libgvplugin_dot_layout.6.dylib

I don't know if It respond to you question

commented

the file exist at this path, I check it

I'm also seeing this issue -

Andrews-MacBook-Pro:graphviz andrewortman$ otool -L /usr/local/Cellar/graphviz/2.38.0/lib/graphviz/libgvplugin_dot_layout.6.dylib
/usr/local/Cellar/graphviz/2.38.0/lib/graphviz/libgvplugin_dot_layout.6.dylib:
/usr/local/lib/graphviz/libgvplugin_dot_layout.6.dylib (compatibility version 7.0.0, current version 7.0.0)
/usr/local/Cellar/graphviz/2.38.0/lib/libgvc.6.dylib (compatibility version 7.0.0, current version 7.0.0)
/usr/local/Cellar/graphviz/2.38.0/lib/libxdot.4.dylib (compatibility version 5.0.0, current version 5.0.0)
/usr/local/Cellar/graphviz/2.38.0/lib/libcgraph.6.dylib (compatibility version 7.0.0, current version 7.0.0)
/usr/local/Cellar/graphviz/2.38.0/lib/libpathplan.4.dylib (compatibility version 5.0.0, current version 5.0.0)
/usr/lib/libexpat.1.dylib (compatibility version 7.0.0, current version 7.2.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
/usr/local/Cellar/graphviz/2.38.0/lib/libcdt.5.dylib (compatibility version 6.0.0, current version 6.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)

I just got this to work by uninstalling the brew version of graphviz and install 0.26 from graphviz's site:
www.graphviz.org/Download_macos.php

I'm using Mac OSX Yosemite, if that provides additional context

Hope that helps

I see the same thing, but I do have /usr/local/Cellar/graphviz/2.38.0/lib/graphviz/libgvplugin_dot_layout.6.dylib on my system. (Mac 10.10.5, graphviz installed via Homebrew.)

it seems installing using brew will make a link

-r--r--r--  1 yiranzhang  admin   139K Aug 31 22:14 libgvplugin_dot_layout.6.dylib
lrwxr-xr-x  1 yiranzhang  admin    30B Oct 22  2014 libgvplugin_dot_layout.dylib ->libgvplugin_dot_layout.6.dylib

so that file we are looking for has only write permission. And there is another link to the file thats accessable.

If this is still a problem, please reopen the issue.

Is there actually a resolution to this issue?

Here's a workaround works for me. It appears somehow libgvplugin_dot_layout.6.dylib" fails to load its dependency libgvc.dylib so I preload it using

DYLD_INSERT_LIBRARIES=/usr/local/opt/graphviz/lib/libgvc.6.dylib qlua ./test_nngraph.lua

Alternatively,
or one can change torch/install/share/lua/5.1/graph/graphviz.lua, replacing this one

   graphvizOk, graphviz = pcall(function() return ffi.load('libgvc') end)

with

   graphvizOk, graphviz = pcall(function() return ffi.load('libgvc', true) end)

to achieve same effect. Hope this give hints to find the root cause.

reinstalling the graph package should fix the issue permanently.

luarocks install graph

Reinstalling the graph package using @soumith recommendation works. Thanks! I didn't try the solution recommended by @0wu.

I had the same issue as @wpm had (just a different version and macOS 10.14.5).

bash-3.2$ sfdp -v
sfdp - graphviz version 2.40.1 (20161225.0304)
libdir = "/usr/local/Cellar/graphviz/2.40.1/lib/graphviz"
Warning: Could not load "/usr/local/Cellar/graphviz/2.40.1/lib/graphviz/libgvplugin_neato_layout.6.dylib" - file not found
There is no layout engine support for "sfdp"
Use one of: circo dot fdp neato nop nop1 nop2 osage patchwork sfdp twopi

Then I did this to get the reason why the lib can't be loaded:

bash-3.2$ DYLD_INSERT_LIBRARIES=/usr/local/opt/graphviz/lib/graphviz/libgvplugin_neato_layout.6.dylib sfdp -v
dyld: Library not loaded: /usr/local/opt/gettext/lib/libintl.8.dylib
  Referenced from: /usr/local/opt/graphviz/lib/graphviz/libgvplugin_neato_layout.6.dylib
  Reason: image not found
Segmentation fault: 11

A finally fixed the issue by brew link --force gettext