ContextMapper/context-mapper-dsl

Graphviz has not been found on your system

Closed this issue · 19 comments

Describe the bug
Whenever I try to generate graphical context map, I get the message "Graphviz has not been found on your system". Although graphviz is installed on my Debian Linux host - this what I obtain when I run apt-file list graphviz:

graphviz: /usr/bin/acyclic
graphviz: /usr/bin/bcomps
graphviz: /usr/bin/ccomps
graphviz: /usr/bin/circo
graphviz: /usr/bin/cluster
graphviz: /usr/bin/diffimg
graphviz: /usr/bin/dijkstra
graphviz: /usr/bin/dot
graphviz: /usr/bin/dot2gxl
graphviz: /usr/bin/dot_builtins
graphviz: /usr/bin/dotty
graphviz: /usr/bin/edgepaint
graphviz: /usr/bin/fdp
graphviz: /usr/bin/gc
graphviz: /usr/bin/gml2gv
graphviz: /usr/bin/graphml2gv
graphviz: /usr/bin/gv2gml
graphviz: /usr/bin/gv2gxl
graphviz: /usr/bin/gvcolor
graphviz: /usr/bin/gvgen
graphviz: /usr/bin/gvmap
graphviz: /usr/bin/gvmap.sh
graphviz: /usr/bin/gvpack
graphviz: /usr/bin/gvpr
graphviz: /usr/bin/gxl2dot
graphviz: /usr/bin/gxl2gv
graphviz: /usr/bin/lefty
graphviz: /usr/bin/lneato
graphviz: /usr/bin/mm2gv
graphviz: /usr/bin/neato
graphviz: /usr/bin/nop
graphviz: /usr/bin/osage
graphviz: /usr/bin/patchwork
graphviz: /usr/bin/prune
graphviz: /usr/bin/sccmap
graphviz: /usr/bin/sfdp
graphviz: /usr/bin/tred
graphviz: /usr/bin/twopi
graphviz: /usr/bin/unflatten
graphviz: /usr/bin/vimdot
graphviz: /usr/share/doc/graphviz/README.Debian
graphviz: /usr/share/doc/graphviz/TODO.Debian
graphviz: /usr/share/doc/graphviz/changelog.Debian.gz
graphviz: /usr/share/doc/graphviz/changelog.gz
graphviz: /usr/share/doc/graphviz/copyright
graphviz: /usr/share/graphviz/lefty/box.lefty
graphviz: /usr/share/graphviz/lefty/def.lefty
graphviz: /usr/share/graphviz/lefty/dotty.lefty
graphviz: /usr/share/graphviz/lefty/dotty_draw.lefty
graphviz: /usr/share/graphviz/lefty/dotty_edit.lefty
graphviz: /usr/share/graphviz/lefty/dotty_layout.lefty
graphviz: /usr/share/graphviz/lefty/dotty_ui.lefty
graphviz: /usr/share/graphviz/lefty/fractal.lefty
graphviz: /usr/share/graphviz/lefty/fractal2.lefty
graphviz: /usr/share/graphviz/lefty/lefty.psp
graphviz: /usr/share/graphviz/lefty/slides.lefty
graphviz: /usr/share/graphviz/lefty/tree.lefty
graphviz: /usr/share/man/man1/acyclic.1.gz
graphviz: /usr/share/man/man1/bcomps.1.gz
graphviz: /usr/share/man/man1/ccomps.1.gz
graphviz: /usr/share/man/man1/circo.1.gz
graphviz: /usr/share/man/man1/cluster.1.gz
graphviz: /usr/share/man/man1/diffimg.1.gz
graphviz: /usr/share/man/man1/dijkstra.1.gz
graphviz: /usr/share/man/man1/dot.1.gz
graphviz: /usr/share/man/man1/dotty.1.gz
graphviz: /usr/share/man/man1/edgepaint.1.gz
graphviz: /usr/share/man/man1/fdp.1.gz
graphviz: /usr/share/man/man1/gc.1.gz
graphviz: /usr/share/man/man1/gml2gv.1.gz
graphviz: /usr/share/man/man1/graphml2gv.1.gz
graphviz: /usr/share/man/man1/gv2gml.1.gz
graphviz: /usr/share/man/man1/gv2gxl.1.gz
graphviz: /usr/share/man/man1/gvcolor.1.gz
graphviz: /usr/share/man/man1/gvgen.1.gz
graphviz: /usr/share/man/man1/gvmap.1.gz
graphviz: /usr/share/man/man1/gvmap.sh.1.gz
graphviz: /usr/share/man/man1/gvpack.1.gz
graphviz: /usr/share/man/man1/gvpr.1.gz
graphviz: /usr/share/man/man1/gxl2gv.1.gz
graphviz: /usr/share/man/man1/lefty.1.gz
graphviz: /usr/share/man/man1/lneato.1.gz
graphviz: /usr/share/man/man1/mingle.1.gz
graphviz: /usr/share/man/man1/mm2gv.1.gz
graphviz: /usr/share/man/man1/neato.1.gz
graphviz: /usr/share/man/man1/nop.1.gz
graphviz: /usr/share/man/man1/osage.1.gz
graphviz: /usr/share/man/man1/patchwork.1.gz
graphviz: /usr/share/man/man1/prune.1.gz
graphviz: /usr/share/man/man1/sccmap.1.gz
graphviz: /usr/share/man/man1/sfdp.1.gz
graphviz: /usr/share/man/man1/smyrna.1.gz
graphviz: /usr/share/man/man1/tred.1.gz
graphviz: /usr/share/man/man1/twopi.1.gz
graphviz: /usr/share/man/man1/unflatten.1.gz
graphviz: /usr/share/man/man1/vimdot.1.gz
graphviz: /usr/share/man/man7/graphviz.7.gz
graphviz: /usr/share/menu/graphviz

To Reproduce
Steps to reproduce the behavior:

  1. Go to CML file
  2. Click on it
  3. Scroll down to 'Generate Graphical Context Map'
  4. See message "Graphviz has not be found on your system"

Expected behavior
Graphical context map gets generated.

IDE and Plugin (please complete the following information):

  • Eclipse version: 2019-12 (4.14.0)
  • ContextMapper plugin version: latest

Interesting. I assume /usr/bin is part of your PATH environment variable, right? Can you execute the Graphviz commands such as dot from the terminal?

@stefan-ka Yep. The dot command works fine for me.

This is weird. Works perfectly fine on my Ubuntu. Can you check your PATH variable anyway? Does it contain /usr/bin?

@stefan-ka Yep, it contains it.

Hmmm, I cannot reproduce this... Maybe a user/permission problem?
The error message means that the dot executable cannot be found in any of the directories listed by your PATH variable.

@kaisbe I also set up a Debian Linux and tested it with Eclipse 2019-12, and it works fine for me.
There must be an issue with your PATH variable (separators always correct?) or the system user under which you run Eclipse cannot see the executable for permission reasons...

@stefan-ka OK. This is what's in PATH variable:

/home/kais/.sdkman/candidates/sbt/current/bin:/home/kais/.sdkman/candidates/java/current/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

@stefan-ka

or the system user under which you run Eclipse cannot see the executable for permission reasons...

As a regular user (on the same session where I use Eclipse), This is what I get using ls /usr/bin | grep dot:

dot
dot2gxl
dot_builtins
dotlockfile
dotty
gxl2dot
vimdot

This sounds very weird, since you were not able to reproduce the issue using the same version of Eclipse.

@kaisbe Really, very weird. Whats the output of ls -l /usr/bin | grep dot?
Is the dot file marked as executable? (x permission?)

@stefan-ka This is the output:

lrwxrwxrwx 1 root root 3 أفريل 8 2019 circo -> dot
lrwxrwxrwx 1 root root 29 أفريل 8 2019 dot -> ../sbin/libgvc6-config-update
lrwxrwxrwx 1 root root 6 أفريل 8 2019 dot2gxl -> gxl2gv
-rwxr-xr-x 1 root root 18808 أفريل 8 2019 dot_builtins
-rwxr-sr-x 1 root mail 18944 ديسمبر 3 2017 dotlockfile
-rwxr-xr-x 1 root root 2085 أفريل 8 2019 dotty
lrwxrwxrwx 1 root root 3 أفريل 8 2019 fdp -> dot
lrwxrwxrwx 1 root root 6 أفريل 8 2019 gxl2dot -> gxl2gv
lrwxrwxrwx 1 root root 3 أفريل 8 2019 neato -> dot
lrwxrwxrwx 1 root root 3 أفريل 8 2019 osage -> dot
lrwxrwxrwx 1 root root 3 أفريل 8 2019 patchwork -> dot
lrwxrwxrwx 1 root root 3 أفريل 8 2019 sfdp -> dot
lrwxrwxrwx 1 root root 3 أفريل 8 2019 twopi -> dot
-rwxr-xr-x 1 root root 1082 أفريل 8 2019 vimdot

@kaisbe This is so weird, I'm running out of ideas...
Can you run the following Java program within your Eclipse?

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

public class Test {

	public static void main(String[] args) throws IOException {
		Path path = Paths.get("/usr/bin");
		System.out.println("directory exists: " + Files.exists(path));
		
		System.out.println("Files named 'dot': ");
		Files.list(path)
			.filter(filePath -> "dot".equals(filePath.getFileName().toString()))
			.filter(filePath -> Files.isRegularFile(filePath))
			.filter(Files::isExecutable)
			.forEach(filePath -> System.out.println(filePath.getFileName().toString()));
	}

}

Do you get the following output?

directory exists: true
Files named 'dot': 
dot

@stefan-ka The output that I'm getting is different:

directory exists: true
Files named 'dot':

@kaisbe Okay, seems like the file cannot be found via Java. Weird. Or can you check if its one of the filters that remove it from the list? Do you get the same output if you remove the two lines filtering regular and executable files?

Or remove all three filter lines and check the output for the dot file...

@stefan-ka I tried removing all the filters, and the program lists many files, but dot isn't one of them.

@stefan-ka The JDK version is openjdk 11.0.6 2020-01-14.

@kaisbe Exactly the same JDK I used on the Debian test machine... Sorry, this is totally weird, but in this case it looks like some problem on your specific system and not with our code... Don't know why this file is not found via Java. Maybe just try to remove Graphviz and install it fresh? :) Sorry, I'm really running out of ideas what could be wrong :)

@stefan-ka OK. No problem. Sorry for this weird issue and thanks a lot for your elaboration. I'm closing this bug report for now, since my current environment is causing this problem. Cheers.

@kaisbe Sorry, I could not help... I hope you can solve it and find a way to use Context Mapper and the Context Map generator.

You could also try to use the generator as we do it in our "standalone" Java application, outside the Eclipse context:
https://github.com/ContextMapper/context-mapper-standalone-example/blob/master/src/main/java/org/contextmapper/standalone/example/ContextMapGeneratorExample.java
However, this way you have to write some lines of Java code. Or just clone the repository above and change the path to your CML file in the class linked above. But I really don't know if this helps, maybe still won't work if the executable cannot be found out of a Java app.