nicolashernandez / PyRATA

"Python Rule-based feAture sTructure Analysis" or "Python Rule-bAsed Text Analysis"

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pyrata-v0.4.0 importError: No module named 'graph_tool'

nicolashernandez opened this issue · comments

On v0.4.0, here the issue:

# python3
Python 3.5.2 (default, Nov 23 2017, 16:37:01) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyrata.re as pyrata_re
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.5/dist-packages/pyrata/re.py", line 39, in <module>
    from pyrata.nfa import *
  File "/usr/local/lib/python3.5/dist-packages/pyrata/nfa.py", line 65, in <module>
    from graph_tool.all import *
ImportError: No module named 'graph_tool'

pyrata-v0.4.0 uses the graph-tool module. On the graph-tool installation instructions you can read:

Python modules are usually very easy to install, typically requiring nothing more that pip install for basically any operating system. For graph-tool, however, the situation is different. This is because, in reality, graph-tool is a C++ library wrapped in Python, and it has many C++ dependencies such as Boost, CGAL and expat, which are not installable via Python-only package management systems such as pip. Because the module lives between the C++ and Python worlds, its installation is done more like a C++ library rather than a typical python module. This means it inherits some of the complexities common of the C++ world that some Python users do not expect.
The easiest way to get going is to use a package manager, for which the installation is fairly straightforward

For Ubuntu, to install via package managers, add the following lines to your /etc/apt/sources.list,

deb http://downloads.skewed.de/apt/DISTRIBUTION DISTRIBUTION universe
deb-src http://downloads.skewed.de/apt/DISTRIBUTION DISTRIBUTION universe

where DISTRIBUTION can be any one of
xenial, yakkety, zesty, artful, bionic. Choose xenial for ubuntu 16.04

After running
apt-get update

if you want to use Python 3, the package can be installed with
apt-get install -y --allow-unauthenticated python3-graph-tool

I tested under a docker image (find attached the Dockerfile. Dont forget to remove the .txt extension to build your image).

The docker ubuntu:16.04 image size is 123 MB. With the pyrata and its requirements (python3, pip3, ply, sympy) but not graph-tool, the image size is 454 MB. It goes up till 937 MB with graph-tool which requires SciPy, numpy....

Dockerfile.txt