`minimize_blockmodel_dl` issue

Hi there. I’m having problems running the following code:

from graph_tool.all import *
g = collection.ns["ego_social/facebook_combined"]
state = minimize_blockmodel_dl(g)

I get the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/vargonis/miniconda3/envs/langchain/lib/python3.11/site-packages/graph_tool/inference/minimize.py", line 128, in minimize_blockmodel_dl
    state = state(g, **state_args)
            ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vargonis/miniconda3/envs/langchain/lib/python3.11/site-packages/graph_tool/inference/blockmodel.py", line 239, in __init__
    B = min(B, self.g.num_vertices())
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vargonis/miniconda3/envs/langchain/lib/python3.11/site-packages/numpy/core/fromnumeric.py", line 2953, in min
    return _wrapreduction(a, np.minimum, 'min', axis, None, out,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vargonis/miniconda3/envs/langchain/lib/python3.11/site-packages/numpy/core/fromnumeric.py", line 88, in _wrapreduction
    return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
numpy.exceptions.AxisError: axis 4039 is out of bounds for array of dimension 0

Here’s what I believe is the relevant info, from conda list:

graph-tool                2.56            py311h35b2f40_0    conda-forge
graph-tool-base           2.56            py311ha6c7e1a_0    conda-forge

I believe this is a bug, because I get the same error with a fresh conda environment (only graph tool installed). Or is it somehow an incompatibility with python 3.11?

I can’t reproduce this. Which numpy version do you have?

numpy 1.25.0 py311h64a7726_0 conda-forge

It’s probably some silly incompatibility with numpy 1.25. Could you please:

  1. Open an issue in the issue tracker: Issues · Tiago Peixoto / graph-tool · GitLab
  2. Try to downgrade to numpy 1.24 to see if you see the same problem?

Hi. Regarding the opening of an issue on your gitlab, that’s the first thing I tried but I still cannot login, I get this:


As for the installation of graph-tool with numpy=1.24, conda fails reporting unsolvable conflicts if I start with python 3.11. I tried it like this:

conda create -n langchain python=3.11 numpy=1.24
conda activate langchain
conda install -c conda-forge graph-tool

Now I’m trying with python 3.10. It takes a while solving the environment. If I manage to install a working version I’ll let you know. Meanwhile, could you tell me which version of python and numpy you’re using?

I have approved your account in gitlab; we can move this there.

I do not observe this issue with Python 3.11.3 and Numpy 1.24.3.

OK, I confirm one gets a working conda environment like this:

conda create -c conda-forge -n your_env_name python=3.11 numpy=1.24 graph-tool

I’ll file an issue later. Thanks for your support, and specially for this nice package. Best,
Rodrigo

1 Like