Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

failure to compile cython .pyx when cimporting some function from sage

Hello, I am working on a sage graph project, and for optimization, I have chosen to move it to cython. The code compiles just fine as is, but for further optimization I will need to use a union find data structure in my cdef function. So far, I was using DisjointSet from sage.sets.disjoint_set in a separate function : my issue is I do not know how to cdef such an object.

My initial attempt to solve this was to cimport the disjoint set class from the sage.sets.disjoint_set.pyx file, and use it to cdef.

This would in summary be something like this :

...

from sage.sets.disjoint_set cimport DisjointSet

cdef DisjointSet D

D = DisjointSet(10)

... Though this does not compile : I get an error related to a library (that I assumed was included in the install of sage). Just in case it was not, I manually installed GAP (which did not solve the problem).

/usr/bin/ld : ne peut trouver -lgap
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-g++' failed with exit status 1

(this message is in french but it translates exactly to "/usr/bin/ld: cannot find -lgap")

I believe this is mostly likely due to me misunderstanding how to import a class from the sage cython files. I had a similar problem when trying to work with bitsets (although the error was on the library pari instead of gap)

In case it is relevant, I am working on Ubuntu 20.04, installed sage with apt (sage version is 9.0).

Thank you in advance for any help.

Pierre

failure to compile cython .pyx when cimporting some function from sage

Hello, Hello,

I am working on a sage Sage graph project, and for optimization, optimization, I have chosen to move it to cython. Cython. The code compiles just fine as is, but for further optimization optimization I will need to use a union find data structure in my cdef function. cdef function. So far, I was using DisjointSet from sage.sets.disjoint_set DisjointSet from sage.sets.disjoint_set in a separate function : function: my issue is I do not know know how to cdef cdef such an object.

My initial attempt to solve this was to cimport cimport the disjoint set class from the sage.sets.disjoint_set.pyx file, sage/sets/disjoint_set.pyx file, and use it to cdef.cdef.

This would in summary be something like this :

...

... from sage.sets.disjoint_set cimport DisjointSet

DisjointSet cdef DisjointSet D

D D = DisjointSet(10)

DisjointSet(10) ...

Though this does not compile : I get an error related to a library library (that I assumed was included in the install of sage). Sage). Just in case it was not, I manually installed GAP GAP (which did not solve the problem).

/usr/bin/ld : ne peut trouver -lgap
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-g++' failed with exit status 1

(this

This message is in french partly in French but it translates exactly to "/usr/bin/ld: to

/usr/bin/ld: cannot find -lgap")

-lgap

I believe this is mostly likely due to me misunderstanding misunderstanding how to import a class from the sage cython files. Sage Cython files. I had a similar problem when trying to work with bitsets bitsets (although the error was on the library pari PARI instead of gap)GAP).

In case it is relevant, I am working on Ubuntu 20.04, 20.04, installed sage Sage with apt (sage (Sage version is 9.0).

Thank you in advance for any help.

Pierre

failure to compile cython .pyx when cimporting some function from sage

Hello,

I am working on a Sage graph project, and for optimization, I have chosen to move it to Cython. The code compiles just fine as is, but for further optimization I will need to use a union find data structure in my cdef function. So far, I was using DisjointSet from sage.sets.disjoint_set in a separate function: my issue is I do not know how to cdef such an object.

My initial attempt to solve this was to cimport the disjoint set class from the sage/sets/disjoint_set.pyx file, and use it to cdef.

This would in summary be something like this :

...

from sage.sets.disjoint_set cimport DisjointSet

cdef DisjointSet D

 D = DisjointSet(10)

...

Though this does not compile : I get an error related to a library (that I assumed was included in the install of Sage). Just in case it was not, I manually installed GAP (which did not solve the problem).

/usr/bin/ld : ne peut trouver -lgap
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-g++' failed with exit status 1

This message is partly in French but it translates exactly to

/usr/bin/ld: cannot find -lgap

I believe this is mostly likely due to me misunderstanding how to import a class from the Sage Cython files. I had a similar problem when trying to work with bitsets (although the error was on the library PARI instead of GAP).

In case it is relevant, I am working on Ubuntu 20.04, installed Sage with apt (Sage version is 9.0).

Thank you in advance for any help.

Pierre

failure to compile cython .pyx when cimporting some function from sage

Hello,

I am working on a Sage graph project, and for optimization, I have chosen to move it to Cython. The code compiles just fine as is, but for further optimization I will need to use a union find data structure in my cdef function. So far, I was using DisjointSet from sage.sets.disjoint_set in a separate function: my issue is I do not know how to cdef such an object.

My initial attempt to solve this was to cimport the disjoint set class from the sage/sets/disjoint_set.pyx file, and use it to cdef.

This would in summary be something like this :

...

from sage.sets.disjoint_set cimport DisjointSet
DisjointSet_of_hashables

cdef DisjointSet DisjointSet_of_hashables D

D = DisjointSet(10)

...

Though this does not compile : I get an error related to a library (that I assumed was included in the install of Sage). Just in case it was not, I manually installed GAP (which did not solve the problem).

/usr/bin/ld : ne peut trouver -lgap
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-g++' failed with exit status 1

This message is partly in French but it translates exactly to

/usr/bin/ld: cannot find -lgap

I believe this is mostly likely due to me misunderstanding how to import a class from the Sage Cython files. I had a similar problem when trying to work with bitsets (although the error was on the library PARI instead of GAP).

In case it is relevant, I am working on Ubuntu 20.04, installed Sage with apt (Sage version is 9.0).

Thank you in advance for any help.

Pierre