hagberg / planarity

Planar graph algorithms
Other
39 stars 11 forks source link

pip install planarity does not work anymore #10

Closed Thomasb81 closed 1 year ago

Thomasb81 commented 1 year ago

Hello

Seems to me that package installation does not work anymore with recent python version

$ python setup.py -h
Compiling planarity/planarity.pyx because it changed.
[1/1] Cythonizing planarity/planarity.pyx
/home/tom/prog/schemadraw_test/venv/lib/python3.11/site-packages/Cython/Compiler/Main.py:384: FutureWarning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases! File: /home/tom/prog/schemadraw_test/planarity/planarity/planarity.pyx
  tree = Parsing.p_module(s, pxd, full_module_name)

Error compiling Cython file:
------------------------------------------------------------
...
#!python
#cython: embedsignature=True
"""
Wrapper for Boyer's (C) planarity algorithms.
"""
cimport cplanarity
        ^
------------------------------------------------------------

planarity/planarity.pyx:6:8: 'cplanarity.pxd' not found

Error compiling Cython file:
------------------------------------------------------------
...
"""
cimport cplanarity
import warnings

cdef class PGraph:
    cdef cplanarity.graphP theGraph
         ^
------------------------------------------------------------

planarity/planarity.pyx:10:9: 'graphP' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
            raise RuntimeError("planarity: Unknown error.")        

    def nodes(self,data=False):
        DRAWPLANAR_ID=1
        cdef cplanarity.DrawPlanarContext *context 
             ^
------------------------------------------------------------

planarity/planarity.pyx:102:13: 'DrawPlanarContext' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
        return nodes

    def edges(self,data=False):
        DRAWPLANAR_ID=1
        cdef cplanarity.DrawPlanarContext *context 
             ^
------------------------------------------------------------

planarity/planarity.pyx:126:13: 'DrawPlanarContext' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
                raise RuntimeError("Unknown input type")
            edges=graph
        n=len(nodes)
        self.nodemap=dict(zip(nodes,range(1,n+1)))
        self.reverse_nodemap=dict(zip(range(1,n+1),nodes))
        self.theGraph = cplanarity.gp_New()
                                  ^
------------------------------------------------------------

planarity/planarity.pyx:40:34: cimported module has no attribute 'gp_New'

Error compiling Cython file:
------------------------------------------------------------
...
        n=len(nodes)
        self.nodemap=dict(zip(nodes,range(1,n+1)))
        self.reverse_nodemap=dict(zip(range(1,n+1),nodes))
        self.theGraph = cplanarity.gp_New()
        cdef int status
        status = cplanarity.gp_InitGraph(self.theGraph, n)
                           ^
------------------------------------------------------------

planarity/planarity.pyx:42:27: cimported module has no attribute 'gp_InitGraph'

Error compiling Cython file:
------------------------------------------------------------
...
        self.nodemap=dict(zip(nodes,range(1,n+1)))
        self.reverse_nodemap=dict(zip(range(1,n+1),nodes))
        self.theGraph = cplanarity.gp_New()
        cdef int status
        status = cplanarity.gp_InitGraph(self.theGraph, n)
        if status != cplanarity.OK:
                               ^
------------------------------------------------------------

planarity/planarity.pyx:43:31: cimported module has no attribute 'OK'

Error compiling Cython file:
------------------------------------------------------------
...
            raise RuntimeError("planarity: failed to initialize graph")
        # add the edges and check return
        seen = set()
        for u,v in edges:
            if (u,v) not in seen and (v,u) not in seen:
                status = cplanarity.gp_AddEdge(self.theGraph, 
                                   ^
------------------------------------------------------------

planarity/planarity.pyx:49:35: cimported module has no attribute 'gp_AddEdge'

Error compiling Cython file:
------------------------------------------------------------
...
        for u,v in edges:
            if (u,v) not in seen and (v,u) not in seen:
                status = cplanarity.gp_AddEdge(self.theGraph, 
                                               self.nodemap[u], 0, 
                                               self.nodemap[v], 0)
                if status == cplanarity.NOTOK:
                                       ^
------------------------------------------------------------

planarity/planarity.pyx:52:39: cimported module has no attribute 'NOTOK'

Error compiling Cython file:
------------------------------------------------------------
...
            if (u,v) not in seen and (v,u) not in seen:
                status = cplanarity.gp_AddEdge(self.theGraph, 
                                               self.nodemap[u], 0, 
                                               self.nodemap[v], 0)
                if status == cplanarity.NOTOK:
                    cplanarity.gp_Free(&self.theGraph)
                              ^
------------------------------------------------------------

planarity/planarity.pyx:53:30: cimported module has no attribute 'gp_Free'

Error compiling Cython file:
------------------------------------------------------------
...
                    cplanarity.gp_Free(&self.theGraph)
                    raise RuntimeError("planarity: failed adding edge.")
                seen.add((u,v))
            else:
                warnings.warn('ignoring parallel edge %s-%s'%(str(u),str(v)))
        self.embedding=cplanarity.NULL
                                 ^
------------------------------------------------------------

planarity/planarity.pyx:58:33: cimported module has no attribute 'NULL'

Error compiling Cython file:
------------------------------------------------------------
...
                warnings.warn('ignoring parallel edge %s-%s'%(str(u),str(v)))
        self.embedding=cplanarity.NULL

    def __dealloc__(self):
        cplanarity.gp_Free(&self.theGraph)
                  ^
------------------------------------------------------------

planarity/planarity.pyx:62:18: cimported module has no attribute 'gp_Free'

Error compiling Cython file:
------------------------------------------------------------
...
        cplanarity.gp_Free(&self.theGraph)

    def embed_planar(self):
        if self.embedding == 0:
            self.embedding = cplanarity.gp_Embed(self.theGraph, 
                                       ^
------------------------------------------------------------

planarity/planarity.pyx:67:39: cimported module has no attribute 'gp_Embed'

Error compiling Cython file:
------------------------------------------------------------
...

    def embed_planar(self):
        if self.embedding == 0:
            self.embedding = cplanarity.gp_Embed(self.theGraph, 
                                             cplanarity.EMBEDFLAGS_PLANAR)
                                                       ^
------------------------------------------------------------

planarity/planarity.pyx:68:55: cimported module has no attribute 'EMBEDFLAGS_PLANAR'

Error compiling Cython file:
------------------------------------------------------------
...

    def embed_planar(self):
        if self.embedding == 0:
            self.embedding = cplanarity.gp_Embed(self.theGraph, 
                                             cplanarity.EMBEDFLAGS_PLANAR)
            cplanarity.gp_SortVertices(self.theGraph)                  
                      ^
------------------------------------------------------------

planarity/planarity.pyx:69:22: cimported module has no attribute 'gp_SortVertices'

Error compiling Cython file:
------------------------------------------------------------
...

    def embed_drawplanar(self):
        status = cplanarity.gp_AttachDrawPlanar(self.theGraph)
        if status == cplanarity.NOTOK:
            raise RuntimeError("planarity: failed attaching drawplanar.")
        status = cplanarity.gp_Embed(self.theGraph, 
                           ^
------------------------------------------------------------

planarity/planarity.pyx:76:27: cimported module has no attribute 'gp_Embed'

Error compiling Cython file:
------------------------------------------------------------
...

    def embed_drawplanar(self):
        status = cplanarity.gp_AttachDrawPlanar(self.theGraph)
        if status == cplanarity.NOTOK:
            raise RuntimeError("planarity: failed attaching drawplanar.")
        status = cplanarity.gp_Embed(self.theGraph, 
                           ^
------------------------------------------------------------

planarity/planarity.pyx:76:27: Compiler crash in AnalyseExpressionsTransform

ModuleNode.body = StatListNode(planarity.pyx:6:0)
StatListNode.stats[2] = StatListNode(planarity.pyx:9:5)
StatListNode.stats[0] = CClassDefNode(planarity.pyx:9:5,
    as_name = 'PGraph',
    class_name = 'PGraph',
    module_name = '',
    punycode_class_name = 'PGraph',
    visibility = 'private')
CClassDefNode.body = StatListNode(planarity.pyx:10:4)
StatListNode.stats[4] = DefNode(planarity.pyx:72:4,
    is_cyfunction = True,
    modifiers = [...]/0,
    name = 'embed_drawplanar',
    np_args_idx = [...]/0,
    num_required_args = 1,
    outer_attrs = [...]/2,
    py_wrapper_required = True,
    reqd_kw_flags_cname = '0',
    used = True)
File 'ExprNodes.py', line 5869, in infer_type: SimpleCallNode(planarity.pyx:76:36,
    result_is_used = True,
    use_managed_ref = True)
File 'ExprNodes.py', line 7322, in infer_type: AttributeNode(planarity.pyx:76:27,
    attribute = 'gp_Embed',
    is_attribute = 1,
    needs_none_check = True,
    result_is_used = True,
    use_managed_ref = True)

Compiler crash traceback from this point on:
  File "/home/tom/prog/schemadraw_test/venv/lib/python3.11/site-packages/Cython/Compiler/ExprNodes.py", line 7322, in infer_type
    if node.entry.type and node.entry.type.is_cfunction:
       ^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'type'
Traceback (most recent call last):
  File "/home/tom/prog/schemadraw_test/planarity/setup.py", line 52, in <module>
    extensions = cythonize(extensions)
                 ^^^^^^^^^^^^^^^^^^^^^
  File "/home/tom/prog/schemadraw_test/venv/lib/python3.11/site-packages/Cython/Build/Dependencies.py", line 1134, in cythonize
    cythonize_one(*args)
  File "/home/tom/prog/schemadraw_test/venv/lib/python3.11/site-packages/Cython/Build/Dependencies.py", line 1301, in cythonize_one
    raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: planarity/planarity.pyx