Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

graph-tool version #69

Open
pavelToman opened this issue May 30, 2024 · 9 comments
Open

graph-tool version #69

pavelToman opened this issue May 30, 2024 · 9 comments

Comments

@pavelToman
Copy link

pavelToman commented May 30, 2024

Hello Dawe!
I am trying to install Schist v0.8.3 on UGent HPC to provide this sw to researchers. We are using EasyBuild to build/install and provide sw - so I like to build from source.
For now I am fighting with the dependency graph-tools. I try to install its latest version v2.68. The installation works fine, but check commands failing:
from graph_tool.all import graph_draw
from graph_tool.all import Graph, BlockState
import graph_tool.inference
All of these return same error:

Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/scratch/gent/vo/001/gvo00117/easybuild/RHEL8/cascadelake-ampere-ib/software/graph-tool/2.68-foss-2023a/lib/python3.11/site-packages/graph_tool/all.py", line 34, in <module>
        from graph_tool.draw import *
      File "/scratch/gent/vo/001/gvo00117/easybuild/RHEL8/cascadelake-ampere-ib/software/graph-tool/2.68-foss-2023a/lib/python3.11/site-packages/graph_tool/draw/__init__.py", line 87, in <module>
        from .. inference import minimize_blockmodel_dl, BlockState, ModularityState
      File "/scratch/gent/vo/001/gvo00117/easybuild/RHEL8/cascadelake-ampere-ib/software/graph-tool/2.68-foss-2023a/lib/python3.11/site-packages/graph_tool/inference/__init__.py", line 331, in <module>
        from . blockmodel import *
      File "/scratch/gent/vo/001/gvo00117/easybuild/RHEL8/cascadelake-ampere-ib/software/graph-tool/2.68-foss-2023a/lib/python3.11/site-packages/graph_tool/inference/blockmodel.py", line 119, in <module>
        @entropy_state_signature
         ^^^^^^^^^^^^^^^^^^^^^^^
      File "/scratch/gent/vo/001/gvo00117/easybuild/RHEL8/cascadelake-ampere-ib/software/graph-tool/2.68-foss-2023a/lib/python3.11/site-packages/graph_tool/inference/base_states.py", line 110, in entropy_state_signature
        warn = "\n".join([" " * (m if j == 0 else m + 4) + l.lstrip() for
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/scratch/gent/vo/001/gvo00117/easybuild/RHEL8/cascadelake-ampere-ib/software/graph-tool/2.68-foss-2023a/lib/python3.11/site-packages/graph_tool/inference/base_states.py", line 110, in <listcomp>
        warn = "\n".join([" " * (m if j == 0 else m + 4) + l.lstrip() for
                          ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
        TypeError: can't multiply sequence by non-int of type 'generator'

What version of graph-tools is recommended to use with Schist v0.8.3 ?

Some details about sw I use:
GCC v12.3.0 + OpenMPI v4.1.5 + FlexiBLAS v3.3.1 + FFTW v3.3.10 + ScaLAPACK v2.2.0
python v3.11.3
Boost v1.83.0
Numpy v1.25.1
Scipy v1.11.1
Pandas v2.0.3
joblib v1.2.0

@dawe
Copy link
Owner

dawe commented May 30, 2024

Hello @pavelToman, my current working installation still uses graph-tool 2.58. I have tried to install gt-2.68 in a test enviroment and cannot reproduce your error, so I guess it's a question you should post on graph-tool issue tracker. Having said that, gt-2.68 (and FWIW gt-2.67 as well) raises a double free error when working with multimodal data.
Given that I am not (yet) exploiting newest features, I suggest you to install gt-2.58, I will add a dependency check on the installer recipe.

@dawe
Copy link
Owner

dawe commented May 30, 2024

Quick update: a fresh install of gt-2.68 on a linux machine (I was on OS X before) doesn't have the double free issue, so I'm not sure what's going on here

@boegel
Copy link

boegel commented May 30, 2024

@dawe Which Python are you using? I think that may be important here.
I can trigger the same error with a weird construct like this:

>>> m = (x+1 for x in range(5))
>>> " " * m
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: can't multiply sequence by non-int of type 'generator'

@pavelToman
Copy link
Author

I just try to build graph-tool v2.59 and all check commands pass ok.
The piece of code that causing the error is:

def entropy_state_signature(cls):
    def entropy(self, **kwargs):
        return self._entropy(**dict(self.get_entropy_args(), **kwargs))
    entropy.__signature__ = inspect.signature(cls._entropy)
    intro, br, rest = cls._entropy.__doc__.partition("\n\n")
    warn = f"""\
    The default arguments of this function are overriden by those
    obtained from :meth:`~{cls.__name__}.get_entropy_args`. To update the
    defaults in a stateful way, :meth:`~{cls.__name__}.update_entropy_args`
    should be called."""
    warn = textwrap.dedent(warn)
    warn = " ".join(warn.splitlines())
    warn = textwrap.fill(warn, width=60, break_long_words=False,
                         replace_whitespace=False)
    warn = f".. warning::\n{warn}"
    lines = cls._entropy.__doc__.splitlines()
    m = min((len(l) - len(l.lstrip()) for l in lines[1:] if l.lstrip() != "")) \
        if len(lines) > 1 else 0
-> warn = "\n".join([" " * (m if j == 0 else m + 4) + l.lstrip() for
                      j, l in enumerate(warn.splitlines())])
    entropy.__doc__ = intro + "\n\n" + warn
    if len(rest) > 0:
        entropy.__doc__ += "\n\n" + rest
    setattr(cls, "entropy", entropy)
    cls.get_entropy_args.__doc__ = \
        cls.get_entropy_args.__doc__.replace("{entropy}",
                                             f":meth:`~{cls.__name__}.entropy`")
    cls.update_entropy_args.__doc__ = \
        cls.update_entropy_args.__doc__.replace("{entropy}",
                                                f":meth:`~{cls.__name__}.entropy`")
    cls.reset_entropy_args.__doc__ = \
        cls.reset_entropy_args.__doc__.replace("{entropy}",
                                               f":meth:`~{cls.__name__}.entropy`")
    return cls

@dawe
Copy link
Owner

dawe commented May 30, 2024

@boegel I tried with a fresh conda install using python 3.12 on Linux without issues. On OS X I tried both 3.10 and 3.12, always raising malloc error (but I suspect it's a clash between graph-tool and joblib)

@dawe
Copy link
Owner

dawe commented May 30, 2024

@pavelToman TBH I haven't ever built gt from source, I relied on the conda binaries

@pavelToman
Copy link
Author

@dawe thank you for your help!
Schist v0.8.3 works now with gt v2.59

@pedrofale
Copy link

Sorry for re-surfacing this, but I'm still having trouble with the graph-tool compatibilities. Could you please provide a working environment for OS X? Thanks!

@dawe dawe reopened this Aug 7, 2024
@dawe
Copy link
Owner

dawe commented Aug 7, 2024

@pedrofale what error do you get? What version of schist and graph-tool do you have? Since v0.8.4 I've forced graph-tool dependency to version 2.59 max, this to avoid issues on OS X.
Currently I'm working on OS X 14.5, python 3.12, schist 0.9.0 and graph-tool 2.59 and everything seems to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants