I recently ran into this same problem, and was about to give up until
coming across Matthias' workaround here which worked.
Maybe this should be added to the documentation of
sage-numerical-backends-gurobi if there isn't a simple fix?
On Wednesday, July 31, 2024 at 2:36:24 PM UTC-4 Matthias Koeppe wrote:
> Try "sage -pip install --no-build-isolation
> sage-numerical-backends-gurobi" as a workaround.
>
> On Monday, July 29, 2024 at 1:18:23 PM UTC-7 Ziyan He wrote:
>
>> My sage version is 10.3, and here is my error log :
>> Collecting sage-numerical-backends-gurobi
>> Using cached sage_numerical_backends_gurobi-10.4.tar.gz (27 kB)
>> Installing build dependencies ... done
>> Getting requirements to build wheel ... done
>> Preparing metadata (pyproject.toml) ... done
>> Requirement already satisfied: sphinx in
>> /home/selinaheyiii/miniforge3/envs/sage/lib/python3.10/site-packages (from
>> sage-numerical-backends-gurobi) (7.4.7)
>> Requirement already satisfied: sphinxcontrib-applehelp in
>> /home/selinaheyiii/miniforge3/envs/sage/lib/python3.10/site-packages (from
>> sphinx->sage-numerical-backends-gurobi) (1.0.8)
>> Requirement already satisfied: sphinxcontrib-devhelp in
>> /home/selinaheyiii/miniforge3/envs/sage/lib/python3.10/site-packages (from
>> sphinx->sage-numerical-backends-gurobi) (1.0.6)
>> Requirement already satisfied: sphinxcontrib-jsmath in
>> /home/selinaheyiii/miniforge3/envs/sage/lib/python3.10/site-packages (from
>> sphinx->sage-numerical-backends-gurobi) (1.0.1)
>> Requirement already satisfied: sphinxcontrib-htmlhelp>=2.0.0 in
>> /home/selinaheyiii/miniforge3/envs/sage/lib/python3.10/site-packages (from
>> sphinx->sage-numerical-backends-gurobi) (2.0.6)
>> Requirement already satisfied: sphinxcontrib-serializinghtml>=1.1.9 in
>> /home/selinaheyiii/miniforge3/envs/sage/lib/python3.10/site-packages (from
>> sphinx->sage-numerical-backends-gurobi) (1.1.10)
>> Requirement already satisfied: sphinxcontrib-qthelp in
>> /home/selinaheyiii/miniforge3/envs/sage/lib/python3.10/site-packages (from
>> sphinx->sage-numerical-backends-gurobi) (1.0.8)
>> Requirement already satisfied: Jinja2>=3.1 in
>> /home/selinaheyiii/miniforge3/envs/sage/lib/python3.10/site-packages (from
>> sphinx->sage-numerical-backends-gurobi) (3.1.4)
>> Requirement already satisfied: Pygments>=2.17 in
>> /home/selinaheyiii/miniforge3/envs/sage/lib/python3.10/site-packages (from
>> sphinx->sage-numerical-backends-gurobi) (2.18.0)
>> Requirement already satisfied: docutils<0.22,>=0.20 in
>> /home/selinaheyiii/miniforge3/envs/sage/lib/python3.10/site-packages (from
>> sphinx->sage-numerical-backends-gurobi) (0.21.2)
>> Requirement already satisfied: snowballstemmer>=2.2 in
>> /home/selinaheyiii/miniforge3/envs/sage/lib/python3.10/site-packages (from
>> sphinx->sage-numerical-backends-gurobi) (2.2.0)
>> Requirement already satisfied: babel>=2.13 in
>> /home/selinaheyiii/miniforge3/envs/sage/lib/python3.10/site-packages (from
>> sphinx->sage-numerical-backends-gurobi) (2.14.0)
>> Requirement already satisfied: alabaster~=0.7.14 in
>> /home/selinaheyiii/miniforge3/envs/sage/lib/python3.10/site-packages (from
>> sphinx->sage-numerical-backends-gurobi) (0.7.16)
>> Requirement already satisfied: imagesize>=1.3 in
>> /home/selinaheyiii/miniforge3/envs/sage/lib/python3.10/site-packages (from
>> sphinx->sage-numerical-backends-gurobi) (1.4.1)
>> Requirement already satisfied: requests>=2.30.0 in
>> /home/selinaheyiii/miniforge3/envs/sage/lib/python3.10/site-packages (from
>> sphinx->sage-numerical-backends-gurobi) (2.32.3)
>> Requirement already satisfied: packaging>=23.0 in
>> /home/selinaheyiii/miniforge3/envs/sage/lib/python3.10/site-packages (from
>> sphinx->sage-numerical-backends-gurobi) (24.1)
>> Requirement already satisfied: tomli>=2 in
>> /home/selinaheyiii/miniforge3/envs/sage/lib/python3.10/site-packages (from
>> sphinx->sage-numerical-backends-gurobi) (2.0.1)
>> Requirement already satisfied: MarkupSafe>=2.0 in
>> /home/selinaheyiii/miniforge3/envs/sage/lib/python3.10/site-packages (from
>> Jinja2>=3.1->sphinx->sage-numerical-backends-gurobi) (2.1.5)
>> Requirement already satisfied: charset-normalizer<4,>=2 in
>> /home/selinaheyiii/miniforge3/envs/sage/lib/python3.10/site-packages (from
>> requests>=2.30.0->sphinx->sage-numerical-backends-gurobi) (3.3.2)
>> Requirement already satisfied: idna<4,>=2.5 in
>> /home/selinaheyiii/miniforge3/envs/sage/lib/python3.10/site-packages (from
>> requests>=2.30.0->sphinx->sage-numerical-backends-gurobi) (3.7)
>> Requirement already satisfied: urllib3<3,>=1.21.1 in
>> /home/selinaheyiii/miniforge3/envs/sage/lib/python3.10/site-packages (from
>> requests>=2.30.0->sphinx->sage-numerical-backends-gurobi) (2.2.2)
>> Requirement already satisfied: certifi>=2017.4.17 in
>> /home/selinaheyiii/miniforge3/envs/sage/lib/python3.10/site-packages (from
>> requests>=2.30.0->sphinx->sage-numerical-backends-gurobi) (2024.7.4)
>> Building wheels for collected packages: sage-numerical-backends-gurobi
>> Building wheel for sage-numerical-backends-gurobi (pyproject.toml) ...
>> error
>> error: subprocess-exited-with-error
>>
>> × Building wheel for sage-numerical-backends-gurobi (pyproject.toml)
>> did not run successfully.
>> │ exit code: 1
>> ╰─> [513 lines of output]
>> Using
>> gurobi_include_directories=['/home/selinaheyiii/gurobi/gurobi1003/linux64/include'],
>>
>> libraries=['gurobi100'],
>> library_dirs=['/home/selinaheyiii/gurobi/gurobi1003/linux64/lib']
>> Using compile_time_env: {'HAVE_SAGE_CPYTHON_STRING': True,
>> 'HAVE_ADD_COL_UNTYPED_ARGS': True}
>>
>> /tmp/pip-build-env-ezxvtb8a/overlay/lib/python3.10/site-packages/Cython/Compiler/Main.py:381:
>>
>> FutureWarning: Cython directive 'language_level' not set, using '3str' for
>> now (Py3). This has changed from earlier releases! File:
>> /tmp/pip-install-va8hoabd/sage-numerical-backends-gurobi_63b87e7e44de4bf9be38e8aac072bc7c/sage_numerical_backends_gurobi/gurobi_backend.pxd
>> tree = Parsing.p_module(s, pxd, full_module_name)
>>
>>
>> Error compiling Cython file:
>> ------------------------------------------------------------
>> ...
>> # the Free Software Foundation, either version 2 of the License, or
>> # (at your option) any later version.
>> # http://www.gnu.org/licenses/
>>
>>
>> #*****************************************************************************
>>
>> from sage.numerical.backends.generic_backend cimport GenericBackend
>> ^
>> ------------------------------------------------------------
>>
>> sage_numerical_backends_gurobi/gurobi_backend.pxd:17:0:
>> 'sage/numerical/backends/generic_backend.pxd' not found
>>
>>
>> Error compiling Cython file:
>> ------------------------------------------------------------
>> ...
>> # the Free Software Foundation, either version 2 of the License, or
>> # (at your option) any later version.
>> # http://www.gnu.org/licenses/
>>
>>
>> #*****************************************************************************
>>
>> from sage.numerical.backends.generic_backend cimport GenericBackend
>> ^
>> ------------------------------------------------------------
>>
>> sage_numerical_backends_gurobi/gurobi_backend.pxd:17:0:
>> 'sage/numerical/backends/generic_backend/GenericBackend.pxd' not found
>>
>>
>> Error compiling Cython file:
>> ------------------------------------------------------------
>> ...
>> int GRB_SUBOPTIMAL
>>
>>
>>
>>
>> cdef class GurobiBackend(GenericBackend):
>> ^
>> ------------------------------------------------------------
>>
>> sage_numerical_backends_gurobi/gurobi_backend.pxd:105:25: First
>> base of 'GurobiBackend' is not an extension type
>> warning: sage_numerical_backends_gurobi/gurobi_backend.pyx:37:0:
>> The 'IF' statement is deprecated and will be removed in a future Cython
>> version. Consider using runtime conditions or C macros instead. See
>> https://github.com/cython/cython/issues/4310
>> warning: sage_numerical_backends_gurobi/gurobi_backend.pyx:213:4:
>> The 'IF' statement is deprecated and will be removed in a future Cython
>> version. Consider using runtime conditions or C macros instead. See
>> https://github.com/cython/cython/issues/4310
>> warning: sage_numerical_backends_gurobi/gurobi_backend.pyx:378:4:
>> The 'IF' statement is deprecated and will be removed in a future Cython
>> version. Consider using runtime conditions or C macros instead. See
>> https://github.com/cython/cython/issues/4310
>> warning: sage_numerical_backends_gurobi/gurobi_backend.pyx:1118:4:
>> The 'IF' statement is deprecated and will be removed in a future Cython
>> version. Consider using runtime conditions or C macros instead. See
>> https://github.com/cython/cython/issues/4310
>>
>>
>> Error compiling Cython file:
>> ------------------------------------------------------------
>> ...
>> IF HAVE_SAGE_CPYTHON_STRING:
>> from sage.cpython.string cimport char_to_str, str_to_bytes
>> from sage.cpython.string import FS_ENCODING
>> from sage.numerical.mip import MIPSolverException
>>
>> cdef class GurobiBackend(GenericBackend):
>> ^
>> ------------------------------------------------------------
>>
>> sage_numerical_backends_gurobi/gurobi_backend.pyx:42:25: First base
>> of 'GurobiBackend' is not an extension type
>>
>>
>> Error compiling Cython file:
>> ------------------------------------------------------------
>> ...
>> self.set_sense(1 if maximization else -1)
>>
>> self.set_verbosity(0)
>> self.obj_constant_term = 0.0
>>
>> cpdef int add_variable(self, lower_bound=0.0, upper_bound=None,
>> binary=False, continuous=False, integer=False, obj=0.0, name=None,
>> coefficients=None) except -1:
>> ^
>> ------------------------------------------------------------
>>
>> sage_numerical_backends_gurobi/gurobi_backend.pyx:104:10: C method
>> 'add_variable' not previously declared in definition part of extension type
>> 'GurobiBackend'
>> warning: sage_numerical_backends_gurobi/gurobi_backend.pyx:214:21:
>> noexcept clause is ignored for function returning Python object
>>
>>
>> Error compiling Cython file:
>> ------------------------------------------------------------
>> ...
>> check(self.env,GRBupdatemodel(self.model))
>>
>> return self.ncols()-1
>>
>> IF HAVE_ADD_COL_UNTYPED_ARGS:
>> cpdef add_col(self, indices, coeffs) noexcept:
>> ^
>> ------------------------------------------------------------
>>
>> sage_numerical_backends_gurobi/gurobi_backend.pyx:214:14: C method
>> 'add_col' not previously declared in definition part of extension type
>> 'GurobiBackend'
>> warning: sage_numerical_backends_gurobi/gurobi_backend.pyx:274:27:
>> noexcept clause is ignored for function returning Python object
>>
>>
>> Error compiling Cython file:
>> ------------------------------------------------------------
>> ...
>> length.
>>
>> """
>> self.add_variable(coefficients = zip(indices, coeffs))
>>
>> cpdef set_variable_type(self, int variable, int vtype) noexcept:
>> ^
>> ------------------------------------------------------------
>>
>> sage_numerical_backends_gurobi/gurobi_backend.pyx:274:10: C method
>> 'set_variable_type' not previously declared in definition part of extension
>> type 'GurobiBackend'
>> warning: sage_numerical_backends_gurobi/gurobi_backend.pyx:312:19:
>> noexcept clause is ignored for function returning Python object
>>
>>
>> Error compiling Cython file:
>> ------------------------------------------------------------
>> ...
>> error = GRBsetcharattrelement(self.model, "VType",
>> variable, 'C')
>> check(self.env, error)
>>
>> check(self.env,GRBupdatemodel(self.model))
>>
>> cpdef set_sense(self, int sense) noexcept:
>> ^
>> ------------------------------------------------------------
>>
>> sage_numerical_backends_gurobi/gurobi_backend.pyx:312:10: C method
>> 'set_sense' not previously declared in definition part of extension type
>> 'GurobiBackend'
>> warning: sage_numerical_backends_gurobi/gurobi_backend.pyx:343:31:
>> noexcept clause is ignored for function returning Python object
>>
>>
>> Error compiling Cython file:
>> ------------------------------------------------------------
>> ...
>> error = GRBsetintattr(self.model, "ModelSense", +1)
>>
>> check(self.env, error)
>> check(self.env,GRBupdatemodel(self.model))
>>
>> cpdef objective_coefficient(self, int variable, coeff=None)
>> noexcept:
>> ^
>> ------------------------------------------------------------
>>
>> sage_numerical_backends_gurobi/gurobi_backend.pyx:343:10: C method
>> 'objective_coefficient' not previously declared in definition part of
>> extension type 'GurobiBackend'
>> warning: sage_numerical_backends_gurobi/gurobi_backend.pyx:379:26:
>> noexcept clause is ignored for function returning Python object
>>
>>
>> Error compiling Cython file:
>> ------------------------------------------------------------
>> ...
>> error = GRBgetdblattrelement(self.model, "Obj",
>> variable, value)
>> check(self.env, error)
>> return value[0]
>>
>> IF HAVE_SAGE_CPYTHON_STRING:
>> cpdef problem_name(self, name=None) noexcept:
>> ^
>> ------------------------------------------------------------
>>
>> sage_numerical_backends_gurobi/gurobi_backend.pyx:379:14: C method
>> 'problem_name' not previously declared in definition part of extension type
>> 'GurobiBackend'
>> warning: sage_numerical_backends_gurobi/gurobi_backend.pyx:446:23:
>> noexcept clause is ignored for function returning Python object
>>
>>
>> Error compiling Cython file:
>> ------------------------------------------------------------
>> ...
>> else:
>> value = char_to_str(pp_name[0])
>>
>> return value
>>
>> cpdef set_objective(self, list coeff, d = 0.0) noexcept:
>> ^
>> ------------------------------------------------------------
>>
>> sage_numerical_backends_gurobi/gurobi_backend.pyx:446:10: C method
>> 'set_objective' not previously declared in definition part of extension
>> type 'GurobiBackend'
>> warning: sage_numerical_backends_gurobi/gurobi_backend.pyx:492:23:
>> noexcept clause is ignored for function returning Python object
>>
>>
>> Error compiling Cython file:
>> ------------------------------------------------------------
>> ...
>>
>> check(self.env,GRBupdatemodel(self.model))
>>
>> self.obj_constant_term = d
>>
>> cpdef set_verbosity(self, int level) noexcept:
>> ^
>> ------------------------------------------------------------
>>
>> sage_numerical_backends_gurobi/gurobi_backend.pyx:492:10: C method
>> 'set_verbosity' not previously declared in definition part of extension
>> type 'GurobiBackend'
>> warning: sage_numerical_backends_gurobi/gurobi_backend.pyx:515:27:
>> noexcept clause is ignored for function returning Python object
>>
>>
>> Error compiling Cython file:
>> ------------------------------------------------------------
>> ...
>> else:
>> error = GRBsetintparam(self.env, "OutputFlag", 0)
>>
>> check(self.env, error)
>>
>> cpdef remove_constraint(self, int i) noexcept:
>> ^
>> ------------------------------------------------------------
>>
>> sage_numerical_backends_gurobi/gurobi_backend.pyx:515:10: C method
>> 'remove_constraint' not previously declared in definition part of extension
>> type 'GurobiBackend'
>> warning: sage_numerical_backends_gurobi/gurobi_backend.pyx:550:31:
>> noexcept clause is ignored for function returning Python object
>>
>>
>> Error compiling Cython file:
>> ------------------------------------------------------------
>> ...
>> check(self.env, error)
>>
>> error = GRBupdatemodel(self.model)
>> check(self.env,error)
>>
>> cpdef add_linear_constraint(self, coefficients, lower_bound,
>> upper_bound, name=None) noexcept:
>> ^
>> ------------------------------------------------------------
>>
>> sage_numerical_backends_gurobi/gurobi_backend.pyx:550:10: C method
>> 'add_linear_constraint' not previously declared in definition part of
>> extension type 'GurobiBackend'
>> warning: sage_numerical_backends_gurobi/gurobi_backend.pyx:627:13:
>> noexcept clause is ignored for function returning Python object
>>
>>
>> Error compiling Cython file:
>> ------------------------------------------------------------
>> ...
>> check(self.env,error)
>>
>> sig_free(row_i)
>> sig_free(row_values)
>>
>> cpdef row(self, int index) noexcept:
>> ^
>> ------------------------------------------------------------
>>
>> sage_numerical_backends_gurobi/gurobi_backend.pyx:627:10: C method
>> 'row' not previously declared in definition part of extension type
>> 'GurobiBackend'
>> warning: sage_numerical_backends_gurobi/gurobi_backend.pyx:679:20:
>> noexcept clause is ignored for function returning Python object
>>
>>
>> Error compiling Cython file:
>> ------------------------------------------------------------
>> ...
>> sig_free(p_values)
>>
>> return indices, values
>>
>>
>> cpdef row_bounds(self, int index) noexcept:
>> ^
>> ------------------------------------------------------------
>>
>> sage_numerical_backends_gurobi/gurobi_backend.pyx:679:10: C method
>> 'row_bounds' not previously declared in definition part of extension type
>> 'GurobiBackend'
>> warning: sage_numerical_backends_gurobi/gurobi_backend.pyx:720:20:
>> noexcept clause is ignored for function returning Python object
>>
>>
>> Error compiling Cython file:
>> ------------------------------------------------------------
>> ...
>> elif sense[0] == '<':
>> return (None, d[0])
>> else:
>> return (d[0],d[0])
>>
>> cpdef col_bounds(self, int index) noexcept:
>> ^
>> ------------------------------------------------------------
>>
>> sage_numerical_backends_gurobi/gurobi_backend.pyx:720:10: C method
>> 'col_bounds' not previously declared in definition part of extension type
>> 'GurobiBackend'
>>
>>
>> Error compiling Cython file:
>> ------------------------------------------------------------
>> ...
>> check(self.env, error)
>>
>> return (None if lb[0] <= -GRB_INFINITY else lb[0],
>> None if ub[0] >= GRB_INFINITY else ub[0])
>>
>> cpdef int solve(self) except -1:
>> ^
>> ------------------------------------------------------------
>>
>> sage_numerical_backends_gurobi/gurobi_backend.pyx:758:10: C method
>> 'solve' not previously declared in definition part of extension type
>> 'GurobiBackend'
>> warning: sage_numerical_backends_gurobi/gurobi_backend.pyx:795:29:
>> noexcept clause is ignored for function returning Python object
>>
>>
>> Error compiling Cython file:
>> ------------------------------------------------------------
>> ...
>> # Has there been a problem ?
>> if status[0] != GRB_OPTIMAL:
>> raise MIPSolverException("Gurobi:
>> "+mip_status.get(status[0], "unknown error during call to GRBoptimize :
>> "+str(status[0])))
>>
>>
>> cpdef get_objective_value(self) noexcept:
>> ^
>> ------------------------------------------------------------
>>
>> sage_numerical_backends_gurobi/gurobi_backend.pyx:795:10: C method
>> 'get_objective_value' not previously declared in definition part of
>> extension type 'GurobiBackend'
>> warning: sage_numerical_backends_gurobi/gurobi_backend.pyx:826:28:
>> noexcept clause is ignored for function returning Python object
>>
>>
>> Error compiling Cython file:
>> ------------------------------------------------------------
>> ...
>>
>> check(self.env,GRBgetdblattr(self.model, "ObjVal", <double*
>> >p_value))
>>
>> return p_value[0] + <double>self.obj_constant_term
>>
>> cpdef get_variable_value(self, int variable) noexcept:
>> ^
>> ------------------------------------------------------------
>>
>> sage_numerical_backends_gurobi/gurobi_backend.pyx:826:10: C method
>> 'get_variable_value' not previously declared in definition part of
>> extension type 'GurobiBackend'
>>
>>
>> Error compiling Cython file:
>> ------------------------------------------------------------
>> ...
>> if self.is_variable_continuous(variable):
>> return value[0]
>> else:
>> return round(value[0])
>>
>> cpdef int ncols(self) noexcept:
>> ^
>> ------------------------------------------------------------
>>
>> sage_numerical_backends_gurobi/gurobi_backend.pyx:859:10: C method
>> 'ncols' not previously declared in definition part of extension type
>> 'GurobiBackend'
>>
>>
>> Error compiling Cython file:
>> ------------------------------------------------------------
>> ...
>> """
>> cdef int i[1]
>> check(self.env,GRBgetintattr(self.model, "NumVars", i))
>> return i[0]
>>
>> cpdef int nrows(self) noexcept:
>> ^
>> ------------------------------------------------------------
>>
>> sage_numerical_backends_gurobi/gurobi_backend.pyx:878:10: C method
>> 'nrows' not previously declared in definition part of extension type
>> 'GurobiBackend'
>> warning: sage_numerical_backends_gurobi/gurobi_backend.pyx:897:18:
>> noexcept clause is ignored for function returning Python object
>>
>>
>> Error compiling Cython file:
>> ------------------------------------------------------------
>> ...
>> """
>> cdef int i[1]
>> check(self.env,GRBgetintattr(self.model, "NumConstrs", i))
>> return i[0]
>>
>> cpdef col_name(self, int index) noexcept:
>> ^
>> ------------------------------------------------------------
>>
>> sage_numerical_backends_gurobi/gurobi_backend.pyx:897:10: C method
>> 'col_name' not previously declared in definition part of extension type
>> 'GurobiBackend'
>> warning: sage_numerical_backends_gurobi/gurobi_backend.pyx:922:18:
>> noexcept clause is ignored for function returning Python object
>>
>>
>> Error compiling Cython file:
>> ------------------------------------------------------------
>> ...
>> value = ""
>> else:
>> value = char_to_str(name[0])
>> return value
>>
>> cpdef row_name(self, int index) noexcept:
>> ^
>> ------------------------------------------------------------
>>
>> sage_numerical_backends_gurobi/gurobi_backend.pyx:922:10: C method
>> 'row_name' not previously declared in definition part of extension type
>> 'GurobiBackend'
>>
>>
>> Error compiling Cython file:
>> ------------------------------------------------------------
>> ...
>> value = ""
>> else:
>> value = char_to_str(name[0])
>> return value
>>
>> cpdef bint is_variable_binary(self, int index) noexcept:
>> ^
>> ------------------------------------------------------------
>>
>> sage_numerical_backends_gurobi/gurobi_backend.pyx:946:10: C method
>> 'is_variable_binary' not previously declared in definition part of
>> extension type 'GurobiBackend'
>>
>>
>> Error compiling Cython file:
>> ------------------------------------------------------------
>> ...
>> cdef char vtype[1]
>> check(self.env, GRBgetcharattrelement(self.model, "VType",
>> index, <char *> vtype))
>> return vtype[0] == 'B'
>>
>>
>> cpdef bint is_variable_integer(self, int index) noexcept:
>> ^
>> ------------------------------------------------------------
>>
>> sage_numerical_backends_gurobi/gurobi_backend.pyx:971:10: C method
>> 'is_variable_integer' not previously declared in definition part of
>> extension type 'GurobiBackend'
>>
>>
>> Error compiling Cython file:
>> ------------------------------------------------------------
>> ...
>> """
>> cdef char vtype[1]
>> check(self.env, GRBgetcharattrelement(self.model, "VType",
>> index, <char *> vtype))
>> return vtype[0] == 'I'
>>
>> cpdef bint is_variable_continuous(self, int index) noexcept:
>> ^
>> ------------------------------------------------------------
>>
>> sage_numerical_backends_gurobi/gurobi_backend.pyx:995:10: C method
>> 'is_variable_continuous' not previously declared in definition part of
>> extension type 'GurobiBackend'
>>
>>
>> Error compiling Cython file:
>> ------------------------------------------------------------
>> ...
>> """
>> cdef char vtype[1]
>> check(self.env, GRBgetcharattrelement(self.model, "VType",
>> index, <char *> vtype))
>> return vtype[0] == 'C'
>>
>> cpdef bint is_maximization(self) noexcept:
>> ^
>> ------------------------------------------------------------
>>
>> sage_numerical_backends_gurobi/gurobi_backend.pyx:1022:10: C method
>> 'is_maximization' not previously declared in definition part of extension
>> type 'GurobiBackend'
>> warning: sage_numerical_backends_gurobi/gurobi_backend.pyx:1040:30:
>> noexcept clause is ignored for function returning Python object
>>
>>
>> Error compiling Cython file:
>> ------------------------------------------------------------
>> ...
>> """
>> cdef int sense[1]
>> check(self.env,GRBgetintattr(self.model, "ModelSense", <int
>> *> sense))
>> return sense[0] == -1
>>
>> cpdef variable_upper_bound(self, int index, value = False)
>> noexcept:
>> ^
>> ------------------------------------------------------------
>>
>> sage_numerical_backends_gurobi/gurobi_backend.pyx:1040:10: C method
>> 'variable_upper_bound' not previously declared in definition part of
>> extension type 'GurobiBackend'
>> warning: sage_numerical_backends_gurobi/gurobi_backend.pyx:1078:30:
>> noexcept clause is ignored for function returning Python object
>>
>>
>> Error compiling Cython file:
>> ------------------------------------------------------------
>> ...
>> else:
>> error = GRBgetdblattrelement(self.model, "UB", index,
>> <double *> b)
>> check(self.env, error)
>> return None if b[0] >= GRB_INFINITY else b[0]
>>
>> cpdef variable_lower_bound(self, int index, value = False)
>> noexcept:
>> ^
>> ------------------------------------------------------------
>>
>> sage_numerical_backends_gurobi/gurobi_backend.pyx:1078:10: C method
>> 'variable_lower_bound' not previously declared in definition part of
>> extension type 'GurobiBackend'
>> warning: sage_numerical_backends_gurobi/gurobi_backend.pyx:1119:22:
>> noexcept clause is ignored for function returning Python object
>>
>>
>> Error compiling Cython file:
>> ------------------------------------------------------------
>> ...
>> error = GRBgetdblattrelement(self.model, "LB", index,
>> <double *> b)
>> check(self.env, error)
>> return None if b[0] <= -GRB_INFINITY else b[0]
>>
>> IF HAVE_SAGE_CPYTHON_STRING:
>> cpdef write_lp(self, filename) noexcept:
>> ^
>> ------------------------------------------------------------
>>
>> sage_numerical_backends_gurobi/gurobi_backend.pyx:1119:14: C method
>> 'write_lp' not previously declared in definition part of extension type
>> 'GurobiBackend'
>> warning: sage_numerical_backends_gurobi/gurobi_backend.pyx:1142:23:
>> noexcept clause is ignored for function returning Python object
>>
>>
>> Error compiling Cython file:
>> ------------------------------------------------------------
>> ...
>> ....: p.write_lp(os.path.join(f,
>> "lp_problem.lp"))
>> """
>> filename = str_to_bytes(filename, FS_ENCODING,
>> 'surrogateescape')
>> check(self.env, GRBwrite(self.model, filename))
>>
>> cpdef write_mps(self, filename, int modern) noexcept:
>> ^
>> ------------------------------------------------------------
>>
>> sage_numerical_backends_gurobi/gurobi_backend.pyx:1142:14: C method
>> 'write_mps' not previously declared in definition part of extension type
>> 'GurobiBackend'
>> warning: sage_numerical_backends_gurobi/gurobi_backend.pyx:1188:26:
>> noexcept clause is ignored for function returning Python object
>>
>>
>> Error compiling Cython file:
>> ------------------------------------------------------------
>> ...
>>
>> """
>> check(self.env, GRBwrite(self.model, filename))
>>
>>
>> cpdef solver_parameter(self, name, value = None) noexcept:
>> ^
>> ------------------------------------------------------------
>>
>> sage_numerical_backends_gurobi/gurobi_backend.pyx:1188:10: C method
>> 'solver_parameter' not previously declared in definition part of extension
>> type 'GurobiBackend'
>> warning: sage_numerical_backends_gurobi/gurobi_backend.pyx:1273:18:
>> noexcept clause is ignored for function returning Python object
>> Compiling sage_numerical_backends_gurobi/gurobi_backend.pyx because
>> it changed.
>> [1/1] Cythonizing sage_numerical_backends_gurobi/gurobi_backend.pyx
>> Traceback (most recent call last):
>> File
>> "/home/selinaheyiii/miniforge3/envs/sage/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py",
>>
>> line 353, in <module>
>> main()
>> File
>> "/home/selinaheyiii/miniforge3/envs/sage/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py",
>>
>> line 335, in main
>> json_out['return_val'] = hook(**hook_input['kwargs'])
>> File
>> "/home/selinaheyiii/miniforge3/envs/sage/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py",
>>
>> line 251, in build_wheel
>> return _build_backend().build_wheel(wheel_directory,
>> config_settings,
>> File
>> "/tmp/pip-build-env-ezxvtb8a/overlay/lib/python3.10/site-packages/setuptools/build_meta.py",
>>
>> line 415, in build_wheel
>> return self._build_with_temp_dir(
>> File
>> "/tmp/pip-build-env-ezxvtb8a/overlay/lib/python3.10/site-packages/setuptools/build_meta.py",
>>
>> line 397, in _build_with_temp_dir
>> self.run_setup()
>> File
>> "/tmp/pip-build-env-ezxvtb8a/overlay/lib/python3.10/site-packages/setuptools/build_meta.py",
>>
>> line 313, in run_setup
>> exec(code, locals())
>> File "<string>", line 116, in <module>
>> File
>> "/tmp/pip-build-env-ezxvtb8a/overlay/lib/python3.10/site-packages/Cython/Build/Dependencies.py",
>>
>> line 1154, in cythonize
>> cythonize_one(*args)
>> File
>> "/tmp/pip-build-env-ezxvtb8a/overlay/lib/python3.10/site-packages/Cython/Build/Dependencies.py",
>>
>> line 1321, in cythonize_one
>> raise CompileError(None, pyx_file)
>> Cython.Compiler.Errors.CompileError:
>> sage_numerical_backends_gurobi/gurobi_backend.pyx
>> [end of output]
>>
>> note: This error originates from a subprocess, and is likely not a
>> problem with pip.
>> ERROR: Failed building wheel for sage-numerical-backends-gurobi
>> Failed to build sage-numerical-backends-gurobi
>> ERROR: Could not build wheels for sage-numerical-backends-gurobi, which
>> is required to install pyproject.toml-based projects
>>
>> Thanks for replying.
>>
>> Matthias Koeppe <[email protected]> 于2024年7月28日周日 02:10写道:
>>
>>> Which Sage version; logs please.
>>>
>>> On Tuesday, July 23, 2024 at 8:28:06 AM UTC-7 Ziyan He wrote:
>>>
>>>> When I try to use pip install to install
>>>> sage-numerical-backends-gurobi, I encounter the following error:
>>>>
>>>> Error compiling Cython file:
>>>> ------------------------------------------------------------ ... # the
>>>> Free
>>>> Software Foundation, either version 2 of the License, or # (at your
>>>> option)
>>>> any later version. # https://www.gnu.org/licenses/
>>>> #*****************************************************************************
>>>>
>>>> from sage.numerical.backends.generic_backend cimport GenericBackend ^
>>>> ------------------------------------------------------------
>>>> sage_numerical_backends_coin/coin_backend.pxd::0:
>>>> 'sage/numerical/backends/generic_backend.pxd' not found.
>>>>
>>>> I'm certain that sage.numerical.backends.generic_backend is present in
>>>> the package. When installing sage-numerical-backends-coin, I encountered
>>>> the same issue. How can I resolve this?
>>>>
>>> --
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "sage-support" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/sage-support/DtN_MnlvEqI/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/sage-support/7aa5e0a7-cda1-4f99-b0a0-8df4e0ed096an%40googlegroups.com
>>>
>>> <https://groups.google.com/d/msgid/sage-support/7aa5e0a7-cda1-4f99-b0a0-8df4e0ed096an%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/sage-support/c99fbd01-3228-4de9-b66d-52103efc1b8dn%40googlegroups.com.