plt-tud / rdf-uml-diagram

Graphical representation of RDF set similar to UML diagrams
6 stars 4 forks source link

install on Ubuntu #1

Open jmvanel opened 8 years ago

jmvanel commented 8 years ago

Hi

I'm not a python developper, but I feel this should not prevent me from using rdf-uml-diagram :) .

The README does not tell precisely how to install.

I attempted this on Ubuntu 14.4 LTS.

pip3 install rdflib
pip3 install pygraphviz

The Ubuntu package python-rdflib version 2.4.2-3build1 is also installed. But:

./rdfUmlDiagram.py test/test.trig
Traceback (most recent call last):
  File "./rdfUmlDiagram.py", line 43, in <module>
    from rdflib import Dataset
ImportError: No module named 'rdflib'
markusgraube commented 8 years ago

Hi, it works with rdflib version 4.

You should not need the Ubuntu package, only the version via pip

When I install rdflib via pip3, I get version 4.2.1

$ pip3 install rdflib
Downloading/unpacking rdflib
  Downloading rdflib-4.2.1.tar.gz (889kB): 889kB downloaded
  Running setup.py (path:/tmp/pip-build-48nfhka0/rdflib/setup.py) egg_info for package rdflib
    no previously-included directories found matching 'docs/_build'
    warning: no previously-included files matching '*.pyc' found anywhere in distribution
    warning: no previously-included files matching '*$py.class' found anywhere in distribution
    Skipping optional fixer: buffer
    Skipping optional fixer: idioms
    Skipping optional fixer: set_literal
    Skipping optional fixer: ws_comma

    no previously-included directories found matching 'docs/_build'
    warning: no previously-included files matching '*.pyc' found anywhere in distribution
    warning: no previously-included files matching '*$py.class' found anywhere in distribution
Downloading/unpacking isodate (from rdflib)
  Downloading isodate-0.5.4.tar.gz
  Running setup.py (path:/tmp/pip-build-48nfhka0/isodate/setup.py) egg_info for package isodate

Downloading/unpacking pyparsing (from rdflib)
  Downloading pyparsing-2.0.6-py2.py3-none-any.whl
Installing collected packages: rdflib, isodate, pyparsing
  Running setup.py install for rdflib
    no previously-included directories found matching 'docs/_build'
    warning: no previously-included files matching '*.pyc' found anywhere in distribution
    warning: no previously-included files matching '*$py.class' found anywhere in distribution
    Skipping optional fixer: buffer
    Skipping optional fixer: idioms
    Skipping optional fixer: set_literal
    Skipping optional fixer: ws_comma

    no previously-included directories found matching 'docs/_build'
    warning: no previously-included files matching '*.pyc' found anywhere in distribution
    warning: no previously-included files matching '*$py.class' found anywhere in distribution
    Installing csv2rdf script to /home/mgraube/Dokumente/workingCopies/rdf-uml-diagram/python-test/bin
    Installing rdfs2dot script to /home/mgraube/Dokumente/workingCopies/rdf-uml-diagram/python-test/bin
    Installing rdfgraphisomorphism script to /home/mgraube/Dokumente/workingCopies/rdf-uml-diagram/python-test/bin
    Installing rdf2dot script to /home/mgraube/Dokumente/workingCopies/rdf-uml-diagram/python-test/bin
    Installing rdfpipe script to /home/mgraube/Dokumente/workingCopies/rdf-uml-diagram/python-test/bin
  Running setup.py install for isodate
    Fixing build/lib/isodate/isodates.py build/lib/isodate/duration.py build/lib/isodate/isoerror.py build/lib/isodate/isotzinfo.py build/lib/isodate/isotime.py build/lib/isodate/isoduration.py build/lib/isodate/tzinfo.py build/lib/isodate/__init__.py build/lib/isodate/isostrf.py build/lib/isodate/isodatetime.py build/lib/isodate/tests/test_date.py build/lib/isodate/tests/test_duration.py build/lib/isodate/tests/test_datetime.py build/lib/isodate/tests/test_pickle.py build/lib/isodate/tests/test_time.py build/lib/isodate/tests/test_strf.py build/lib/isodate/tests/__init__.py
    Skipping optional fixer: buffer
    Skipping optional fixer: idioms
    Skipping optional fixer: set_literal
    Skipping optional fixer: ws_comma
    Fixing build/lib/isodate/isodates.py build/lib/isodate/duration.py build/lib/isodate/isoerror.py build/lib/isodate/isotzinfo.py build/lib/isodate/isotime.py build/lib/isodate/isoduration.py build/lib/isodate/tzinfo.py build/lib/isodate/__init__.py build/lib/isodate/isostrf.py build/lib/isodate/isodatetime.py build/lib/isodate/tests/test_date.py build/lib/isodate/tests/test_duration.py build/lib/isodate/tests/test_datetime.py build/lib/isodate/tests/test_pickle.py build/lib/isodate/tests/test_time.py build/lib/isodate/tests/test_strf.py build/lib/isodate/tests/__init__.py
    Skipping optional fixer: buffer
    Skipping optional fixer: idioms
    Skipping optional fixer: set_literal
    Skipping optional fixer: ws_comma

Successfully installed rdflib isodate pyparsing
Cleaning up...
$ python3
Python 3.4.3+ (default, Oct 14 2015, 16:03:50) 
[GCC 5.2.1 20151010] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import rdflib
INFO:rdflib:RDFLib Version: 4.2.1
jmvanel commented 8 years ago

Thanks Markus

I supposed that a local install wih pip3 was possible. With sudo I was able to install rdflib, but pygraphviz failed. However I have Ubuntu package libcgraph6 version 2.36.0-0ubuntu3.1,

jmv@clemence-XPS-L412Z:~/apps/rdf-uml-diagram-master$ sudo pip3 install pygraphviz
Downloading/unpacking pygraphviz
  Downloading pygraphviz-1.3.1.tar.gz (103kB): 103kB downloaded
  Running setup.py (path:/tmp/pip_build_root/pygraphviz/setup.py) egg_info for package pygraphviz

    warning: no previously-included files matching '*~' found anywhere in distribution
    warning: no previously-included files matching '*.pyc' found anywhere in distribution
    warning: no previously-included files matching '.svn' found anywhere in distribution
    no previously-included directories found matching 'doc/build'
Installing collected packages: pygraphviz
  Running setup.py install for pygraphviz
    Package libcgraph was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libcgraph.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libcgraph' found
    Trying pkg-config
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip_build_root/pygraphviz/setup.py", line 87, in <module>
        tests_require=['nose>=0.10.1', 'doctest-ignore-unicode>=0.1.0',],
      File "/usr/lib/python3.4pygraphviz/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/lib/python3.4/distutils/dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python3.4/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/tmp/pip_build_root/pygraphviz/setup_commands.py", line 44, in modified_run
        self.include_path, self.library_path = get_graphviz_dirs()
      File "/tmp/pip_build_root/pygraphviz/setup_extra.py", line 121, in get_graphviz_dirs
        include_dirs, library_dirs = _pkg_config()
      File "/tmp/pip_build_root/pygraphviz/setup_extra.py", line 44, in _pkg_config
        output = S.check_output(['pkg-config', '--libs-only-L', 'libcgraph'])
      File "/usr/lib/python3.4/subprocess.py", line 620, in check_output
        raise CalledProcessError(retcode, process.args, output=output)
    subprocess.CalledProcessError: Command '['pkg-config', '--libs-only-L', 'libcgraph']' returned non-zero exit status 1
    Complete output from command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/pygraphviz/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-t_44zzj4-record/install-record.txt --single-version-externally-managed --compile:
    running install

Package libcgraph was not found in the pkg-config search path.

Perhaps you should add the directory containing `libcgraph.pc'

to the PKG_CONFIG_PATH environment variable

No package 'libcgraph' found

Trying pkg-config

Traceback (most recent call last):

  File "<string>", line 1, in <module>

  File "/tmp/pip_build_root/pygraphviz/setup.py", line 87, in <module>

    tests_require=['nose>=0.10.1', 'doctest-ignore-unicode>=0.1.0',],

  File "/usr/lib/python3.4/distutils/core.py", line 148, in setup

    dist.run_commands()

  File "/usr/lib/python3.4/distutils/dist.py", line 955, in run_commands

    self.run_command(cmd)

  File "/usr/lib/python3.4/distutils/dist.py", line 974, in run_command

    cmd_obj.run()

  File "/tmp/pip_build_root/pygraphviz/setup_commands.py", line 44, in modified_run

    self.include_path, self.library_path = get_graphviz_dirs()

  File "/tmp/pip_build_root/pygraphviz/setup_extra.py", line 121, in get_graphviz_dirs

    include_dirs, library_dirs = _pkg_config()

  File "/tmp/pip_build_root/pygraphviz/setup_extra.py", line 44, in _pkg_config

    output = S.check_output(['pkg-config', '--libs-only-L', 'libcgraph'])

  File "/usr/lib/python3.4/subprocess.py", line 620, in check_output

    raise CalledProcessError(retcode, process.args, output=output)

subprocess.CalledProcessError: Command '['pkg-config', '--libs-only-L', 'libcgraph']' returned non-zero exit status 1

----------------------------------------
Cleaning up...
Command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/pygraphviz/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-t_44zzj4-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/pygraphviz
Storing debug log for failure in /home/jmv/.pip/pip.log
markusgraube commented 8 years ago

Okay, this sounds as if you need to install graphviz libraries beforehand.

Try

apt-get install libgraphviz-dev
jmvanel commented 8 years ago

Indeed, it helps. I seems that pygraphviz forgot to specify the dependency to libgraphviz-dev. And by the way I still don't know hif it's possible to install rdf-uml-diagram using the setup.py file within it.

In the meantime I worked on a translator from OWL to UML model for ArgoUML: http://svn.code.sf.net/p/eulergui/code/trunk/eulergui/html/documentation.html#L332411 I'll let you know when it's uploaded :) .

But I'm not out of the dependency hell !

jmv@clemence-XPS-L412Z:~/src/rdf-uml-diagram-master$ sudo pip3 install pygraphviz
[sudo] password for jmv: 
Downloading/unpacking pygraphviz
  Downloading pygraphviz-1.3.1.tar.gz (103kB): 103kB downloaded
  Running setup.py (path:/tmp/pip_build_root/pygraphviz/setup.py) egg_info for package pygraphviz

    warning: no previously-included files matching '*~' found anywhere in distribution
    warning: no previously-included files matching '*.pyc' found anywhere in distribution
    warning: no previously-included files matching '.svn' found anywhere in distribution
    no previously-included directories found matching 'doc/build'
Installing collected packages: pygraphviz
  Running setup.py install for pygraphviz
    Trying pkg-config
    include_dirs=/usr/include/graphviz
    library_dirs=

    warning: no previously-included files matching '*~' found anywhere in distribution
    warning: no previously-included files matching '*.pyc' found anywhere in distribution
    warning: no previously-included files matching '.svn' found anywhere in distribution
    no previously-included directories found matching 'doc/build'
    building 'pygraphviz._graphviz' extension
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/graphviz -I/usr/include/python3.4m -c pygraphviz/graphviz_wrap.c -o build/temp.linux-x86_64-3.4/pygraphviz/graphviz_wrap.o
    pygraphviz/graphviz_wrap.c: In function ‘agattr_label’:
    pygraphviz/graphviz_wrap.c:3321:5: warning: return makes integer from pointer without a cast [enabled by default]
         return agattr(g, kind, name, val);
         ^
    x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.4/pygraphviz/graphviz_wrap.o -L -lcgraph -lcdt -o build/lib.linux-x86_64-3.4/pygraphviz/_graphviz.cpython-34m.so
Successfully installed pygraphviz
Cleaning up...
jmv@clemence-XPS-L412Z:~/src/rdf-uml-diagram-master$ less README.md 
jmv@clemence-XPS-L412Z:~/src/rdf-uml-diagram-master$ ./rdfUmlDiagram.py test/test.trig
Traceback (most recent call last):
  File "./rdfUmlDiagram.py", line 45, in <module>
    from umlpygraphvizdiagram import UmlPygraphVizDiagram
  File "/home/jmv/src/rdf-uml-diagram-master/umlpygraphvizdiagram.py", line 6, in <module>
    from pygraphviz import AGraph
  File "/usr/local/lib/python3.4/dist-packages/pygraphviz/__init__.py", line 58, in <module>
    from .agraph import AGraph, Node, Edge, Attribute, ItemAttribute, DotError
  File "/usr/local/lib/python3.4/dist-packages/pygraphviz/agraph.py", line 26, in <module>
    from . import graphviz as gv
  File "/usr/local/lib/python3.4/dist-packages/pygraphviz/graphviz.py", line 28, in <module>
    _graphviz = swig_import_helper()
  File "/usr/local/lib/python3.4/dist-packages/pygraphviz/graphviz.py", line 24, in swig_import_helper
    _mod = imp.load_module('_graphviz', fp, pathname, description)
  File "/usr/lib/python3.4/imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
ImportError: /usr/local/lib/python3.4/dist-packages/pygraphviz/_graphviz.cpython-34m.so: undefined symbol: Agundirected
markusgraube commented 8 years ago

Uhh, I don't really have a clue what's going on here.

I suppose that it has something to do with

library_dirs=

so that the library _graphviz.cpython-34m.so isn't installed in the correct folder /usr/local/lib/python3.4/dist-packages/pygraphviz/ (as it is at my computer)

And sorry, the setup.py script doesn't work correctly. It was just a try for myself if I understand this python setup stuff. However since you have to install graphviz beforehand it's not that easy.

jmvanel commented 8 years ago

No, it's not the cause, the .so you mentioned is were expected :

locate graphviz.cpython-34m.so
/usr/local/lib/python3.4/dist-packages/pygraphviz/_graphviz.cpython-34m.so

If I'm reading correctly the message: undefined symbol: Agundirected it is _graphviz.cpython-34m.so that tries to call the symbol: Agundirected , and it's nowhere in the loaded libraries.

This is confirmed by the nm command :

nm /usr/local/lib/python3.4/dist-packages/pygraphviz/_graphviz.cpython-34m.so | grep Agundirected
                 U Agundirected
0000000000004cc0 t Swig_var_Agundirected_get
0000000000005200 t Swig_var_Agundirected_set

But on your machine Agundirected is somewhere :) . So if you run ldd also we will have a clue of what is missing on my machine:

ldd  /usr/local/lib/python3.4/dist-packages/pygraphviz/_graphviz.cpython-34m.so 
    linux-vdso.so.1 =>  (0x00007ffe011c6000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f90034d9000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f9003114000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f9003907000)

What is your OS and version ?

dandaman commented 8 years ago

Hi Jean-Marc and Markus,

I'm in the same situation as Jean-Marc. Ubuntu 14.04. Had graphviz preinstalled and installed python3-dev, as I got an error about missing Python.h first, but now I also get:

./rdfUmlDiagram.py test/test.trig Traceback (most recent call last): File "./rdfUmlDiagram.py", line 45, in from umlpygraphvizdiagram import UmlPygraphVizDiagram File "/home/lang/software/ontology/rdf-uml-diagram/umlpygraphvizdiagram.py", line 6, in from pygraphviz import AGraph File "/usr/local/lib/python3.4/dist-packages/pygraphviz/init.py", line 58, in from .agraph import AGraph, Node, Edge, Attribute, ItemAttribute, DotError File "/usr/local/lib/python3.4/dist-packages/pygraphviz/agraph.py", line 26, in from . import graphviz as gv File "/usr/local/lib/python3.4/dist-packages/pygraphviz/graphviz.py", line 28, in _graphviz = swig_import_helper() File "/usr/local/lib/python3.4/dist-packages/pygraphviz/graphviz.py", line 24, in swig_import_helper _mod = imp.load_module('_graphviz', fp, pathname, description) File "/usr/lib/python3.4/imp.py", line 243, in load_module return load_dynamic(name, filename, file) ImportError: /usr/local/lib/python3.4/dist-packages/pygraphviz/_graphviz.cpython-34m.so: undefined symbol: Agundirected

Jean-Marc, did you find a solution yet?

Best, Daniel

paolodina commented 8 years ago

@dandaman I had the same issue (xubuntu 15.10) and solved with:

pip install pygraphviz --install-option="--include-path=/usr/include/graphviz" --install-option="--library-path=/usr/lib/graphviz/"

Solution found here. HTH