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

build/pkgs/sage_numerical_backends_coin, sage_numerical_backends_cplex, sage_numerical_backends_gurobi: Update to 10.4 (includes fix for Cython 3) #38319

Merged
merged 12 commits into from
Jul 16, 2024

Conversation

mkoeppe
Copy link
Contributor

@mkoeppe mkoeppe commented Jun 30, 2024

These packages have been broken since our switch to Cython 3.

Switching to new releases:

Changes include noexcept fixes for Cython 3.

📝 Checklist

  • The title is concise and informative.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation and checked the documentation preview.

⌛ Dependencies

Copy link

github-actions bot commented Jun 30, 2024

Documentation preview for this PR (built with commit 9ff0a10; changes) is ready! 🎉
This preview will update shortly after each push to this PR.

@mkoeppe mkoeppe force-pushed the sage_numerical_backends_coin-10.4 branch 2 times, most recently from 27a0ff7 to 28a9bd0 Compare July 1, 2024 05:19
@culler
Copy link
Contributor

culler commented Jul 1, 2024

@mkoeppe: I don't understand what changed here. Does this add the missing noexcept qualifiers?

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jul 1, 2024

Yes, the new release includes this change: sagemath/sage-numerical-backends-coin@bf1e1d3

@mkoeppe mkoeppe changed the title build/pkgs/sage_numerical_backends_coin: Update to 10.4 (includes fix for Cython 3) build/pkgs/sage_numerical_backends_coin, sage_numerical_backends_cplex: Update to 10.4 (includes fix for Cython 3) Jul 2, 2024
@mkoeppe mkoeppe changed the title build/pkgs/sage_numerical_backends_coin, sage_numerical_backends_cplex: Update to 10.4 (includes fix for Cython 3) build/pkgs/sage_numerical_backends_coin, sage_numerical_backends_cplex, sage_numerical_backends_gurobi: Update to 10.4 (includes fix for Cython 3) Jul 2, 2024
@mkoeppe mkoeppe requested a review from tscrim July 2, 2024 04:46
@dcoudert
Copy link
Contributor

dcoudert commented Jul 2, 2024

I can successfully compile this PR on macOS 14.5, but I fail to install sage_numerical_backends_cplex

xxxxxxxxxx:sage dcoudert$ ./sage -pip install sage_numerical_backends_cplex
Collecting sage_numerical_backends_cplex
  Downloading sage_numerical_backends_cplex-10.4rc1.tar.gz (30 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [15 lines of output]
      Traceback (most recent call last):
        File "/Users/dcoudert/sage/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/Users/dcoudert/sage/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/Users/dcoudert/sage/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/private/var/folders/hw/w6ldqpgn52vdvv03cgbkkr3h3lhtdp/T/pip-build-env-ffi6wfku/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 327, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
        File "/private/var/folders/hw/w6ldqpgn52vdvv03cgbkkr3h3lhtdp/T/pip-build-env-ffi6wfku/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 297, in _get_build_requires
          self.run_setup()
        File "/private/var/folders/hw/w6ldqpgn52vdvv03cgbkkr3h3lhtdp/T/pip-build-env-ffi6wfku/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 313, in run_setup
          exec(code, locals())
        File "<string>", line 53, in <module>
      FileNotFoundError: [Errno 2] No such file or directory: '/Users/dcoudert/Applications/CPLEX_Studio2211/cplex/bin/x86-64_osx'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

I have CPLEX Studio 2211 and variable CPLEX_HOME is set to the correct location.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jul 2, 2024

Thanks for testing! Does /Users/dcoudert/Applications/CPLEX_Studio2211/cplex/bin/ exist and what's in there?

@dcoudert
Copy link
Contributor

dcoudert commented Jul 2, 2024

Thanks for testing! Does /Users/dcoudert/Applications/CPLEX_Studio2211/cplex/bin/ exist and what's in there?

/Users/dcoudert/Applications/CPLEX_Studio2211/cplex/bin/ contains directory arm64_osx/ which itself contains files cplex, cplexampand libcplex2211.dylib

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jul 2, 2024

Thanks. Please try with this version

@dcoudert
Copy link
Contributor

dcoudert commented Jul 2, 2024

Collecting sage_numerical_backends_cplex
  Downloading sage_numerical_backends_cplex-10.4rc2.tar.gz (30 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: sphinx in ./local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages (from sage_numerical_backends_cplex) (7.2.6)
Requirement already satisfied: sphinxcontrib-applehelp in ./local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages (from sphinx->sage_numerical_backends_cplex) (1.0.8)
Requirement already satisfied: sphinxcontrib-devhelp in ./local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages (from sphinx->sage_numerical_backends_cplex) (1.0.6)
Requirement already satisfied: sphinxcontrib-jsmath in ./local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages (from sphinx->sage_numerical_backends_cplex) (1.0.1)
Requirement already satisfied: sphinxcontrib-htmlhelp>=2.0.0 in ./local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages (from sphinx->sage_numerical_backends_cplex) (2.0.5)
Requirement already satisfied: sphinxcontrib-serializinghtml>=1.1.9 in ./local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages (from sphinx->sage_numerical_backends_cplex) (1.1.10)
Requirement already satisfied: sphinxcontrib-qthelp in ./local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages (from sphinx->sage_numerical_backends_cplex) (1.0.7)
Requirement already satisfied: Jinja2>=3.0 in ./local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages (from sphinx->sage_numerical_backends_cplex) (3.1.4)
Requirement already satisfied: Pygments>=2.14 in ./local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages (from sphinx->sage_numerical_backends_cplex) (2.18.0)
Requirement already satisfied: docutils<0.21,>=0.18.1 in ./local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages (from sphinx->sage_numerical_backends_cplex) (0.20.1)
Requirement already satisfied: snowballstemmer>=2.0 in ./local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages (from sphinx->sage_numerical_backends_cplex) (2.2.0)
Requirement already satisfied: babel>=2.9 in ./local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages (from sphinx->sage_numerical_backends_cplex) (2.14.0)
Requirement already satisfied: alabaster<0.8,>=0.7 in ./local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages (from sphinx->sage_numerical_backends_cplex) (0.7.16)
Requirement already satisfied: imagesize>=1.3 in ./local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages (from sphinx->sage_numerical_backends_cplex) (1.4.1)
Requirement already satisfied: requests>=2.25.0 in ./local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages (from sphinx->sage_numerical_backends_cplex) (2.32.2)
Requirement already satisfied: packaging>=21.0 in ./local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages (from sphinx->sage_numerical_backends_cplex) (24.0)
Requirement already satisfied: importlib-metadata>=4.8 in ./local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages (from sphinx->sage_numerical_backends_cplex) (7.0.1)
Requirement already satisfied: zipp>=0.5 in ./local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages (from importlib-metadata>=4.8->sphinx->sage_numerical_backends_cplex) (3.19.0)
Requirement already satisfied: MarkupSafe>=2.0 in ./local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages (from Jinja2>=3.0->sphinx->sage_numerical_backends_cplex) (2.1.5)
Requirement already satisfied: charset-normalizer<4,>=2 in ./local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages (from requests>=2.25.0->sphinx->sage_numerical_backends_cplex) (3.3.2)
Requirement already satisfied: idna<4,>=2.5 in ./local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages (from requests>=2.25.0->sphinx->sage_numerical_backends_cplex) (3.7)
Requirement already satisfied: urllib3<3,>=1.21.1 in ./local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages (from requests>=2.25.0->sphinx->sage_numerical_backends_cplex) (2.1.0)
Requirement already satisfied: certifi>=2017.4.17 in ./local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages (from requests>=2.25.0->sphinx->sage_numerical_backends_cplex) (2024.2.2)
Building wheels for collected packages: sage_numerical_backends_cplex
  Building wheel for sage_numerical_backends_cplex (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for sage_numerical_backends_cplex (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [571 lines of output]
      Using cplex_include_directories=['/Users/dcoudert/Applications/CPLEX_Studio2211/cplex/include/ilcplex'], libraries=['cplex2211'], library_dirs=['/Users/dcoudert/Applications/CPLEX_Studio2211/cplex/bin/arm64_osx']
      Using compile_time_env: {'HAVE_SAGE_CPYTHON_STRING': True, 'HAVE_ADD_COL_UNTYPED_ARGS': True}
      /private/var/folders/hw/w6ldqpgn52vdvv03cgbkkr3h3lhtdp/T/pip-build-env-x4uqh8q9/overlay/lib/python3.9/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: /private/var/folders/hw/w6ldqpgn52vdvv03cgbkkr3h3lhtdp/T/pip-install-yjnrtnlx/sage-numerical-backends-cplex_6b59f1aed9b44d21af8b9e851e633026/sage_numerical_backends_cplex/cplex_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.
      #                  https://www.gnu.org/licenses/
      # ****************************************************************************
      
      from sage.numerical.backends.generic_backend cimport GenericBackend
      ^
      ------------------------------------------------------------
      
      sage_numerical_backends_cplex/cplex_backend.pxd:12: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.
      #                  https://www.gnu.org/licenses/
      # ****************************************************************************
      
      from sage.numerical.backends.generic_backend cimport GenericBackend
      ^
      ------------------------------------------------------------
      
      sage_numerical_backends_cplex/cplex_backend.pxd:12:0: 'sage/numerical/backends/generic_backend/GenericBackend.pxd' not found
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          struct cpxlp
      
      ctypedef cpxenv c_cpxenv
      ctypedef cpxlp c_cpxlp
      
      cdef class CPLEXBackend(GenericBackend):
                              ^
      ------------------------------------------------------------
      
      sage_numerical_backends_cplex/cplex_backend.pxd:25:24: First base of 'CPLEXBackend' is not an extension type
      warning: /private/var/folders/hw/w6ldqpgn52vdvv03cgbkkr3h3lhtdp/T/pip-build-env-x4uqh8q9/overlay/lib/python3.9/site-packages/sage/cpython/string.pxd:16:27: noexcept clause is ignored for function returning Python object
      warning: /private/var/folders/hw/w6ldqpgn52vdvv03cgbkkr3h3lhtdp/T/pip-build-env-x4uqh8q9/overlay/lib/python3.9/site-packages/sage/cpython/string.pxd:26:29: noexcept clause is ignored for function returning Python object
      warning: /private/var/folders/hw/w6ldqpgn52vdvv03cgbkkr3h3lhtdp/T/pip-build-env-x4uqh8q9/overlay/lib/python3.9/site-packages/sage/cpython/string.pxd:52:31: noexcept clause is ignored for function returning Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
      
      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 CPLEXBackend(GenericBackend):
                              ^
      ------------------------------------------------------------
      
      sage_numerical_backends_cplex/cplex_backend.pyx:26:24: First base of 'CPLEXBackend' is not an extension type
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                  self.set_sense(-1)
      
              self.obj_constant_term = 0.0
              self._logfilename = ''
      
          cpdef int add_variable(self, lower_bound=0.0, upper_bound=None, binary=False, continuous=False, integer=False, obj=0.0, name=None) except -1:
                ^
      ------------------------------------------------------------
      
      sage_numerical_backends_cplex/cplex_backend.pyx:68:10: C method 'add_variable' not previously declared in definition part of extension type 'CPLEXBackend'
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                  status = CPXchgobj(self.env, self.lp, 1, &n, &c_coeff)
                  check(status)
      
              return n
      
          cpdef int add_variables(self, int number, lower_bound=0.0, upper_bound=None, binary=False, continuous=False, integer=False, obj=0.0, names=None) except -1:
                ^
      ------------------------------------------------------------
      
      sage_numerical_backends_cplex/cplex_backend.pyx:156:10: C method 'add_variables' not previously declared in definition part of extension type 'CPLEXBackend'
      warning: sage_numerical_backends_cplex/cplex_backend.pyx:254:27: noexcept clause is ignored for function returning Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                      status = CPXchgobj(self.env, self.lp, 1, &j, &c_coeff)
                      check(status)
      
              return n
      
          cpdef set_variable_type(self, int variable, int vtype) noexcept:
                ^
      ------------------------------------------------------------
      
      sage_numerical_backends_cplex/cplex_backend.pyx:254:10: C method 'set_variable_type' not previously declared in definition part of extension type 'CPLEXBackend'
      warning: sage_numerical_backends_cplex/cplex_backend.pyx:294:19: noexcept clause is ignored for function returning Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                  type = 'C'
      
              status = CPXchgctype(self.env, self.lp, 1, &variable, &type)
              check(status)
      
          cpdef set_sense(self, int sense) noexcept:
                ^
      ------------------------------------------------------------
      
      sage_numerical_backends_cplex/cplex_backend.pyx:294:10: C method 'set_sense' not previously declared in definition part of extension type 'CPLEXBackend'
      warning: sage_numerical_backends_cplex/cplex_backend.pyx:318:31: noexcept clause is ignored for function returning Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                  False
              """
      
              CPXchgobjsen(self.env, self.lp, -sense)
      
          cpdef objective_coefficient(self, int variable, coeff=None) noexcept:
                ^
      ------------------------------------------------------------
      
      sage_numerical_backends_cplex/cplex_backend.pyx:318:10: C method 'objective_coefficient' not previously declared in definition part of extension type 'CPLEXBackend'
      warning: sage_numerical_backends_cplex/cplex_backend.pyx:355:22: noexcept clause is ignored for function returning Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              else:
                  value = coeff
                  status = CPXchgobj(self.env, self.lp, 1, &variable, &value)
                  check(status)
      
          cpdef problem_name(self, name=None) noexcept:
                ^
      ------------------------------------------------------------
      
      sage_numerical_backends_cplex/cplex_backend.pyx:355:10: C method 'problem_name' not previously declared in definition part of extension type 'CPLEXBackend'
      warning: sage_numerical_backends_cplex/cplex_backend.pyx:391:23: noexcept clause is ignored for function returning Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              else:
                  status = CPXchgprobname(self.env, self.lp, str_to_bytes(name))
                  check(status)
      
      
          cpdef set_objective(self, list coeff, d = 0.0) noexcept:
                ^
      ------------------------------------------------------------
      
      sage_numerical_backends_cplex/cplex_backend.pyx:391:10: C method 'set_objective' not previously declared in definition part of extension type 'CPLEXBackend'
      warning: sage_numerical_backends_cplex/cplex_backend.pyx:443:23: noexcept clause is ignored for function returning Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              sig_free(c_indices)
      
              self.obj_constant_term = d
      
      
          cpdef set_verbosity(self, int level) noexcept:
                ^
      ------------------------------------------------------------
      
      sage_numerical_backends_cplex/cplex_backend.pyx:443:10: C method 'set_verbosity' not previously declared in definition part of extension type 'CPLEXBackend'
      warning: sage_numerical_backends_cplex/cplex_backend.pyx:467:27: noexcept clause is ignored for function returning Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                  check(status)
              else:
                  status = CPXsetintparam (self.env, CPX_PARAM_SCRIND, CPX_ON)
                  check(status)
      
          cpdef remove_constraint(self, int i) noexcept:
                ^
      ------------------------------------------------------------
      
      sage_numerical_backends_cplex/cplex_backend.pyx:467:10: C method 'remove_constraint' not previously declared in definition part of extension type 'CPLEXBackend'
      warning: sage_numerical_backends_cplex/cplex_backend.pyx:497:32: noexcept clause is ignored for function returning Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              """
              cdef int status
              status = CPXdelrows(self.env, self.lp, i, i)
              check(status)
      
          cpdef add_linear_constraints(self, int number, lower_bound, upper_bound, names = None) noexcept:
                ^
      ------------------------------------------------------------
      
      sage_numerical_backends_cplex/cplex_backend.pyx:497:10: C method 'add_linear_constraints' not previously declared in definition part of extension type 'CPLEXBackend'
      warning: sage_numerical_backends_cplex/cplex_backend.pyx:576:31: noexcept clause is ignored for function returning Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              sig_free(sense)
              sig_free(bound)
              sig_free(c_names)
              check(status)
      
          cpdef add_linear_constraint(self, coefficients, lower_bound, upper_bound, name = None) noexcept:
                ^
      ------------------------------------------------------------
      
      sage_numerical_backends_cplex/cplex_backend.pyx:576:10: C method 'add_linear_constraint' not previously declared in definition part of extension type 'CPLEXBackend'
      warning: sage_numerical_backends_cplex/cplex_backend.pyx:674:13: noexcept clause is ignored for function returning Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              # Free memory
              sig_free(c_coeff)
              sig_free(c_indices)
              sig_free(c_row)
      
          cpdef row(self, int index) noexcept:
                ^
      ------------------------------------------------------------
      
      sage_numerical_backends_cplex/cplex_backend.pyx:674:10: C method 'row' not previously declared in definition part of extension type 'CPLEXBackend'
      warning: sage_numerical_backends_cplex/cplex_backend.pyx:724:20: noexcept clause is ignored for function returning Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              sig_free(c_coeff)
              sig_free(c_indices)
      
              return (indices, values)
      
          cpdef row_bounds(self, int index) noexcept:
                ^
      ------------------------------------------------------------
      
      sage_numerical_backends_cplex/cplex_backend.pyx:724:10: C method 'row_bounds' not previously declared in definition part of extension type 'CPLEXBackend'
      warning: sage_numerical_backends_cplex/cplex_backend.pyx:772:20: noexcept clause is ignored for function returning Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              elif direction == 'R':
                  status = CPXgetrngval(self.env, self.lp, &rng, index, index)
                  check(status)
                  return (value, value + rng)
      
          cpdef col_bounds(self, int index) noexcept:
                ^
      ------------------------------------------------------------
      
      sage_numerical_backends_cplex/cplex_backend.pyx:772:10: C method 'col_bounds' not previously declared in definition part of extension type 'CPLEXBackend'
      warning: sage_numerical_backends_cplex/cplex_backend.pyx:812:17: noexcept clause is ignored for function returning Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              check(status)
      
              return (None if lb <= -CPX_INFBOUND else lb,
                      None if ub >= +CPX_INFBOUND else ub)
      
          cpdef add_col(self, indices, coeffs) noexcept:
                ^
      ------------------------------------------------------------
      
      sage_numerical_backends_cplex/cplex_backend.pyx:812:10: C method 'add_col' not previously declared in definition part of extension type 'CPLEXBackend'
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
      
              sig_free(c_coeff)
              sig_free(c_indices)
              sig_free(c_col)
      
          cpdef int solve(self) except -1:
                ^
      ------------------------------------------------------------
      
      sage_numerical_backends_cplex/cplex_backend.pyx:887:10: C method 'solve' not previously declared in definition part of extension type 'CPLEXBackend'
      warning: sage_numerical_backends_cplex/cplex_backend.pyx:961:29: noexcept clause is ignored for function returning Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              if solntype_p == CPX_NO_SOLN or not pfeasind_p:
                  raise MIPSolverException("CPLEX: No solution known to be primal feasible is available")
      
              return 0
      
          cpdef get_objective_value(self) noexcept:
                ^
      ------------------------------------------------------------
      
      sage_numerical_backends_cplex/cplex_backend.pyx:961:10: C method 'get_objective_value' not previously declared in definition part of extension type 'CPLEXBackend'
      warning: sage_numerical_backends_cplex/cplex_backend.pyx:1002:36: noexcept clause is ignored for function returning Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              check(status)
      
              return value + <double>self.obj_constant_term
      
      
          cpdef best_known_objective_bound(self) noexcept:
                ^
      ------------------------------------------------------------
      
      sage_numerical_backends_cplex/cplex_backend.pyx:1002:10: C method 'best_known_objective_bound' not previously declared in definition part of extension type 'CPLEXBackend'
      warning: sage_numerical_backends_cplex/cplex_backend.pyx:1045:36: noexcept clause is ignored for function returning Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              status = CPXgetbestobjval(self.env, self.lp, &value)
              check(status)
      
              return value + <double>self.obj_constant_term
      
          cpdef get_relative_objective_gap(self) noexcept:
                ^
      ------------------------------------------------------------
      
      sage_numerical_backends_cplex/cplex_backend.pyx:1045:10: C method 'get_relative_objective_gap' not previously declared in definition part of extension type 'CPLEXBackend'
      warning: sage_numerical_backends_cplex/cplex_backend.pyx:1085:28: noexcept clause is ignored for function returning Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              status = CPXgetmiprelgap (self.env, self.lp, &value)
              check(status)
      
              return value
      
          cpdef get_variable_value(self, int variable) noexcept:
                ^
      ------------------------------------------------------------
      
      sage_numerical_backends_cplex/cplex_backend.pyx:1085:10: C method 'get_variable_value' not previously declared in definition part of extension type 'CPLEXBackend'
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
      
              status = CPXgetctype(self.env, self.lp, &ctype, variable, variable)
      
              return value if (status == 3003 or ctype == 'C') else int(round(value))
      
          cpdef int ncols(self) noexcept:
                ^
      ------------------------------------------------------------
      
      sage_numerical_backends_cplex/cplex_backend.pyx:1122:10: C method 'ncols' not previously declared in definition part of extension type 'CPLEXBackend'
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                  2
              """
      
              return CPXgetnumcols(self.env, self.lp)
      
          cpdef int nrows(self) noexcept:
                ^
      ------------------------------------------------------------
      
      sage_numerical_backends_cplex/cplex_backend.pyx:1140:10: C method 'nrows' not previously declared in definition part of extension type 'CPLEXBackend'
      warning: sage_numerical_backends_cplex/cplex_backend.pyx:1157:18: noexcept clause is ignored for function returning Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                  2
              """
      
              return CPXgetnumrows(self.env, self.lp)
      
          cpdef row_name(self, int index) noexcept:
                ^
      ------------------------------------------------------------
      
      sage_numerical_backends_cplex/cplex_backend.pyx:1157:10: C method 'row_name' not previously declared in definition part of extension type 'CPLEXBackend'
      warning: sage_numerical_backends_cplex/cplex_backend.pyx:1190:18: noexcept clause is ignored for function returning Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              s = char_to_str(n)
              sig_free(n)
      
              return s
      
          cpdef col_name(self, int index) noexcept:
                ^
      ------------------------------------------------------------
      
      sage_numerical_backends_cplex/cplex_backend.pyx:1190:10: C method 'col_name' not previously declared in definition part of extension type 'CPLEXBackend'
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
      
              s = char_to_str(n)
              sig_free(n)
              return s
      
          cpdef bint is_variable_binary(self, int index) noexcept:
                ^
      ------------------------------------------------------------
      
      sage_numerical_backends_cplex/cplex_backend.pyx:1223:10: C method 'is_variable_binary' not previously declared in definition part of extension type 'CPLEXBackend'
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              check(status)
      
              return ctype == 'B'
      
      
          cpdef bint is_variable_integer(self, int index) noexcept:
                ^
      ------------------------------------------------------------
      
      sage_numerical_backends_cplex/cplex_backend.pyx:1259:10: C method 'is_variable_integer' not previously declared in definition part of extension type 'CPLEXBackend'
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              check(status)
      
              return ctype == 'I'
      
      
          cpdef bint is_variable_continuous(self, int index) noexcept:
                ^
      ------------------------------------------------------------
      
      sage_numerical_backends_cplex/cplex_backend.pyx:1294:10: C method 'is_variable_continuous' not previously declared in definition part of extension type 'CPLEXBackend'
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              check(status)
      
              return ctype == 'C'
      
      
          cpdef bint is_maximization(self) noexcept:
                ^
      ------------------------------------------------------------
      
      sage_numerical_backends_cplex/cplex_backend.pyx:1332:10: C method 'is_maximization' not previously declared in definition part of extension type 'CPLEXBackend'
      warning: sage_numerical_backends_cplex/cplex_backend.pyx:1349:30: noexcept clause is ignored for function returning Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                  False
              """
      
              return -1 == CPXgetobjsen(self.env, self.lp)
      
          cpdef variable_upper_bound(self, int index, value = False) noexcept:
                ^
      ------------------------------------------------------------
      
      sage_numerical_backends_cplex/cplex_backend.pyx:1349:10: C method 'variable_upper_bound' not previously declared in definition part of extension type 'CPLEXBackend'
      warning: sage_numerical_backends_cplex/cplex_backend.pyx:1401:30: noexcept clause is ignored for function returning Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                  x = 'U'
                  c_value = value if value is not None else +CPX_INFBOUND
                  status = CPXchgbds(self.env, self.lp, 1, &index, &x, &c_value)
                  check(status)
      
          cpdef variable_lower_bound(self, int index, value = False) noexcept:
                ^
      ------------------------------------------------------------
      
      sage_numerical_backends_cplex/cplex_backend.pyx:1401:10: C method 'variable_lower_bound' not previously declared in definition part of extension type 'CPLEXBackend'
      warning: sage_numerical_backends_cplex/cplex_backend.pyx:1453:18: noexcept clause is ignored for function returning Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                  x = 'L'
                  c_value = value if value is not None else -CPX_INFBOUND
                  status = CPXchgbds(self.env, self.lp, 1, &index, &x, &c_value)
                  check(status)
      
          cpdef write_lp(self, filename) noexcept:
                ^
      ------------------------------------------------------------
      
      sage_numerical_backends_cplex/cplex_backend.pyx:1453:10: C method 'write_lp' not previously declared in definition part of extension type 'CPLEXBackend'
      warning: sage_numerical_backends_cplex/cplex_backend.pyx:1478:19: noexcept clause is ignored for function returning Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              cdef char * ext = "LP"
              filename = str_to_bytes(filename, FS_ENCODING, 'surrogateescape')
              status = CPXwriteprob(self.env, self.lp, filename, ext)
              check(status)
      
          cpdef write_mps(self, filename, int modern) noexcept:
                ^
      ------------------------------------------------------------
      
      sage_numerical_backends_cplex/cplex_backend.pyx:1478:10: C method 'write_mps' not previously declared in definition part of extension type 'CPLEXBackend'
      warning: sage_numerical_backends_cplex/cplex_backend.pyx:1503:18: noexcept clause is ignored for function returning Python object
      warning: sage_numerical_backends_cplex/cplex_backend.pyx:1530:26: noexcept clause is ignored for function returning Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              status = CPXchgprobtype(p.env, p.lp, CPXgetprobtype(self.env, self.lp))
              check(status)
      
              return p
      
          cpdef solver_parameter(self, name, value = None) noexcept:
                ^
      ------------------------------------------------------------
      
      sage_numerical_backends_cplex/cplex_backend.pyx:1530:10: C method 'solver_parameter' not previously declared in definition part of extension type 'CPLEXBackend'
      Compiling sage_numerical_backends_cplex/cplex_backend.pyx because it changed.
      [1/1] Cythonizing sage_numerical_backends_cplex/cplex_backend.pyx
      Traceback (most recent call last):
        File "/Users/dcoudert/sage/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/Users/dcoudert/sage/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/Users/dcoudert/sage/local/var/lib/sage/venv-python3.9/lib/python3.9/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 "/private/var/folders/hw/w6ldqpgn52vdvv03cgbkkr3h3lhtdp/T/pip-build-env-x4uqh8q9/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 415, in build_wheel
          return self._build_with_temp_dir(
        File "/private/var/folders/hw/w6ldqpgn52vdvv03cgbkkr3h3lhtdp/T/pip-build-env-x4uqh8q9/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 397, in _build_with_temp_dir
          self.run_setup()
        File "/private/var/folders/hw/w6ldqpgn52vdvv03cgbkkr3h3lhtdp/T/pip-build-env-x4uqh8q9/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 313, in run_setup
          exec(code, locals())
        File "<string>", line 83, in <module>
        File "/private/var/folders/hw/w6ldqpgn52vdvv03cgbkkr3h3lhtdp/T/pip-build-env-x4uqh8q9/overlay/lib/python3.9/site-packages/Cython/Build/Dependencies.py", line 1154, in cythonize
          cythonize_one(*args)
        File "/private/var/folders/hw/w6ldqpgn52vdvv03cgbkkr3h3lhtdp/T/pip-build-env-x4uqh8q9/overlay/lib/python3.9/site-packages/Cython/Build/Dependencies.py", line 1321, in cythonize_one
          raise CompileError(None, pyx_file)
      Cython.Compiler.Errors.CompileError: sage_numerical_backends_cplex/cplex_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_cplex
Failed to build sage_numerical_backends_cplex
ERROR: Could not build wheels for sage_numerical_backends_cplex, which is required to install pyproject.toml-based projects

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jul 2, 2024

Not sure how much of this is just from using build isolation (there should have been a fallback to no isolation).

Let's try with explicitly using --no-build-isolation, as just pushed

@dcoudert
Copy link
Contributor

dcoudert commented Jul 3, 2024

same result

Building wheels for collected packages: sage_numerical_backends_cplex
  Building wheel for sage_numerical_backends_cplex (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for sage_numerical_backends_cplex (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [571 lines of output]
      Using cplex_include_directories=['/Users/dcoudert/Applications/CPLEX_Studio2211/cplex/include/ilcplex'], libraries=['cplex2211'], library_dirs=['/Users/dcoudert/Applications/CPLEX_Studio2211/cplex/bin/arm64_osx']
      Using compile_time_env: {'HAVE_SAGE_CPYTHON_STRING': True, 'HAVE_ADD_COL_UNTYPED_ARGS': True}
      /private/var/folders/hw/w6ldqpgn52vdvv03cgbkkr3h3lhtdp/T/pip-build-env-ybkijxi8/overlay/lib/python3.9/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: /private/var/folders/hw/w6ldqpgn52vdvv03cgbkkr3h3lhtdp/T/pip-install-z6hjd4qp/sage-numerical-backends-cplex_9b42dcf403ba427687f363662ce46e5b/sage_numerical_backends_cplex/cplex_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.
      #                  https://www.gnu.org/licenses/
      # ****************************************************************************
      
      from sage.numerical.backends.generic_backend cimport GenericBackend
      ^
      ------------------------------------------------------------
      
      sage_numerical_backends_cplex/cplex_backend.pxd:12:0: 'sage/numerical/backends/generic_backend.pxd' not found
...

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jul 3, 2024

Thanks for your patience with this. Here's another version, in which I added cython_namespace_package_support. If this fixes it for you, I'll have to do the same in the other two packages as well.

@dcoudert
Copy link
Contributor

dcoudert commented Jul 3, 2024

Same error. Should I try a distclean ? so far I only recompile with the added PR before triying to install cplex.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jul 3, 2024

distclean would be worth trying, thanks

@dcoudert
Copy link
Contributor

dcoudert commented Jul 3, 2024

unfortunately, it fails with the same error :(

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jul 3, 2024

Could you share your config.log please? Are you using ./configure --disable-editable by any chance?

@dcoudert
Copy link
Contributor

dcoudert commented Jul 3, 2024

Here it is config.log
no trace of disable-editable.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jul 10, 2024

Unfortunately I cannot reproduce this problem. I just installed CPLEX_Studio2211 and installation went through without problem for me

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jul 10, 2024

@maxale Would you be interested in testing this?

@maxale
Copy link
Contributor

maxale commented Jul 10, 2024

I've tested this on CPLEX and Gurobi backends, and they are installed fine (provided that the corresponding environment variables are set).

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jul 12, 2024

Thanks for testing.

Let's get this in please.

@kwankyu
Copy link
Collaborator

kwankyu commented Jul 13, 2024

This works perfectly for me as well. I started from scratch, downloading free versions of cplex and gurobi, and could test examples using coin, cplex, gurobi solvers, respectively.

@dcoudert
Copy link
Contributor

I tried again with sage 10.4.rc3, M1 Max, macOS 14.5, and CPLEX_Studio2211.
Now sage -i sage_numerical_backends_cplex works fine.
I have not tried yet sage -pip install sage-numerical-backends-cplex...

@vbraun vbraun merged commit 9d1f7f2 into sagemath:develop Jul 16, 2024
14 of 34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants