Libgraph_tool_core

I was able to install graph-tool using apt-get install python3-graph-tool. Couldn´t install from source using make, so I do not have it in virtual environment.

However, when I run an example from a repo that uses graph-tool, I get:

import graph_tool.all as gt

Traceback (most recent call last):
File “”, line 1, in
File “/usr/lib/python3/dist-packages/graph_tool/init.py”, line 110, in
dl_import(“from . import libgraph_tool_core as libcore”)
File “/usr/lib/python3/dist-packages/graph_tool/dl_import.py”, line 44, in dl_import
exec(import_expr, local_dict, global_dict)
File “”, line 1, in
SystemError: initialization of libgraph_tool_core raised unreported exception

I am not able to figure out where the error is.

Thanks!

Unfortunately, it’s not possible to provide a solution to your problem or an answer to your question with the information provided.

To enable us to understand the situation, you need to provide all the items below:

  1. Your exact graph-tool version.
  2. Your operating system.
  3. A minimal working example that shows the problem.

Item 3 above is very important! If you provide us only the part of the code that you believe causes the problem, then it is not possible to understand the context that may have contributed to it.

You need to provide us a complete example that runs and reproduces the problem you are observing.

To post code, please use triple back-ticks for proper formatting:

for x in range(100):
    print("hello world")

or upload your files as attachments.

Thanks for your reply!

  1. graph-tool version is 2.58
  2. Kubuntu 22.04
  3. The minimal working example is checking if the installation went ok:
python -c "import graph_tool"

Traceback (most recent call last):
File “”, line 1, in
File “/usr/lib/python3/dist-packages/graph_tool/init.py”, line 110, in
dl_import(“from . import libgraph_tool_core as libcore”)
File “/usr/lib/python3/dist-packages/graph_tool/dl_import.py”, line 44, in dl_import
exec(import_expr, local_dict, global_dict)
File “”, line 1, in
SystemError: initialization of libgraph_tool_core raised unreported exception

Let me know if you need any other information.

Thank you!

Are you sure your python interpreter is the one installed in the system? What is the result of:

$ which python

python: aliased to python3

Please try to understand what the point is; don’t just mechanically answer. Then do

$ which python3

Yes, I understand the point.

$which python3 points to

/usr/bin/python3

which, in turn, is 3.11.6

How did you install graph-tool?

I followed the commands on the website:

add-apt-repository “deb [ arch=amd64 ] Index of /apt DISTRIBUTION main”
apt-key adv --keyserver keys.openpgp.org --recv-key 612DEFB798507F25
apt-get update
apt-get install python3-graph-tool

where I replaced DISTRIBUTION by jammy, which corresponds to Ubuntu version 22.04

Installation went ok, no warnings nor errors.

I just tested the installation on a Ubuntu jammy image (see Dockerfile attached), and got no errors:

$ docker build --build-arg BASE=ubuntu:jammy . --no-cache
[+] Building 161.3s (17/17) FINISHED                                                                docker:default
 => [internal] load .dockerignore                                                                             3.1s
 => => transferring context: 2B                                                                               0.0s
 => [internal] load build definition from Dockerfile                                                          4.4s
 => => transferring dockerfile: 835B                                                                          0.0s
 => [internal] load metadata for docker.io/library/ubuntu:jammy                                               1.5s
 => [auth] library/ubuntu:pull token for registry-1.docker.io                                                 0.0s
 => [ 1/12] FROM docker.io/library/ubuntu:jammy@sha256:2b7412e6465c3c7fc5bb21d3e6f1917c167358449fecac8176c6e  4.0s
 => => resolve docker.io/library/ubuntu:jammy@sha256:2b7412e6465c3c7fc5bb21d3e6f1917c167358449fecac8176c6e49  0.0s
 => => sha256:2b7412e6465c3c7fc5bb21d3e6f1917c167358449fecac8176c6e496e5c1f05f 1.13kB / 1.13kB                0.0s
 => => sha256:c9cf959fd83770dfdefd8fb42cfef0761432af36a764c077aed54bbc5bb25368 424B / 424B                    0.0s
 => => sha256:e4c58958181a5925816faa528ce959e487632f4cfd192f8132f71b32df2744b4 2.30kB / 2.30kB                0.0s
 => => sha256:aece8493d3972efa43bfd4ee3cdba659c0f787f8f59c82fb3e48c87cbb22a12e 29.54MB / 29.54MB              0.6s
 => => extracting sha256:aece8493d3972efa43bfd4ee3cdba659c0f787f8f59c82fb3e48c87cbb22a12e                     2.3s
 => [ 2/12] RUN apt-get update                                                                                6.1s
 => [ 3/12] RUN apt-get -y dist-upgrade                                                                       4.1s
 => [ 4/12] RUN apt-get -y install gnupg2                                                                     7.4s 
 => [ 5/12] RUN apt-get -y install ca-certificates                                                            6.7s 
 => [ 6/12] RUN apt-get -y install software-properties-common                                                22.2s 
 => [ 7/12] RUN apt-key adv --keyserver hkps://keys.openpgp.org --recv-key 612DEFB798507F25                   2.5s 
 => [ 8/12] RUN add-apt-repository "deb https://downloads.skewed.de/apt/ `echo ubuntu:jammy | sed s/[^:]*://  8.5s 
 => [ 9/12] RUN apt-get update                                                                                6.7s 
 => [10/12] RUN apt-get -y install python3-graph-tool                                                        42.2s 
 => [11/12] RUN apt-get -y install python3-matplotlib gir1.2-gtk-3.0 python3-cairo                           24.6s 
 => [12/12] RUN python3 -c "from graph_tool.all import *; show_config(); g = random_graph(10, lambda: 5, dir  3.5s 
 => exporting to image                                                                                       12.5s 
 => => exporting layers                                                                                      12.5s
 => => writing image sha256:b6122d146ae4b87f4c2a5718c680b213ffda4b8c6566e215dd17be318338c9da                  0.0s

It looks like it might be a local issue.

Interesting… I will re-install and come back with the result.

Thanks!