BouchardLab / pyuoi

The Union of Intersections Framework in Python
https://pyuoi.readthedocs.io
Other
13 stars 16 forks source link

Cython>0.29 prevents install from source #214

Closed mckenziephagen closed 1 year ago

mckenziephagen commented 1 year ago

Something changed between Cython 0.29.35 and 3.0 that breaks when you try to install pyuoi from source with pip. Since there's no pinned version in the pyproject.toml, the cython version used defaults to 3, and makes it impossible to install.

This can be band-aided with a pin to Cython 0.29. I'll submit a PR for this, but I'm not familiar with cython, so can't do any larger fix.

full error output:

mphagen@login01:/global/u1/m/mphagen/software/pyuoi> pip install . 
Using pip 23.2.1 from /global/homes/m/mphagen/miniconda3/envs/new_pyuoi_env/lib/python3.12/site-packages/pip (python 3.12)
Processing /global/u1/m/mphagen/software/pyuoi
  Running command pip subprocess to install build dependencies
  Collecting setuptools>=42
    Obtaining dependency information for setuptools>=42 from https://files.pythonhosted.org/packages/bb/26/7945080113158354380a12ce26873dd6c1ebd88d47f5bc24e2c5bb38c16a/setuptools-68.2.2-py3-none-any.whl.metadata
    Downloading setuptools-68.2.2-py3-none-any.whl.metadata (6.3 kB)
  Collecting wheel
    Obtaining dependency information for wheel from https://files.pythonhosted.org/packages/b8/8b/31273bf66016be6ad22bb7345c37ff350276cfd46e389a0c2ac5da9d9073/wheel-0.41.2-py3-none-any.whl.metadata
    Downloading wheel-0.41.2-py3-none-any.whl.metadata (2.2 kB)
  Collecting numpy
    Obtaining dependency information for numpy from https://files.pythonhosted.org/packages/e3/e2/4ecfbc4a2e3f9d227b008c92a5d1f0370190a639b24fec3b226841eaaf19/numpy-1.26.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata
    Downloading numpy-1.26.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (58 kB)
       ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 58.5/58.5 kB 8.0 MB/s eta 0:00:00
  Collecting cython
    Obtaining dependency information for cython from https://files.pythonhosted.org/packages/b6/37/fd496b7cdd8f589ce6bb824f44389ac78272ac8d4ceb593d44fbe44ed0d7/Cython-3.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata
    Downloading Cython-3.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (3.1 kB)
  Downloading setuptools-68.2.2-py3-none-any.whl (807 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 807.9/807.9 kB 75.9 MB/s eta 0:00:00
  Downloading wheel-0.41.2-py3-none-any.whl (64 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 64.8/64.8 kB 18.0 MB/s eta 0:00:00
  Downloading numpy-1.26.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.9 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 17.9/17.9 MB 44.6 MB/s eta 0:00:00
  Downloading Cython-3.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.5/3.5 MB 122.3 MB/s eta 0:00:00
  Installing collected packages: wheel, setuptools, numpy, cython
  Successfully installed cython-3.0.2 numpy-1.26.0 setuptools-68.2.2 wheel-0.41.2
  Installing build dependencies ... done
  Running command Getting requirements to build wheel
  /tmp/pip-build-env-yhse78lt/overlay/lib/python3.12/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: /global/u1/m/mphagen/software/pyuoi/src/pyuoi/lbfgs/_lowlevel.pyx
    tree = Parsing.p_module(s, pxd, full_module_name)

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

          x_a = aligned_copy(x0.ravel())

          try:
              callback_data = (f, progress, x0.shape, args)
              r = lbfgs(n, x_a, fx_final, call_eval,
                                          ^
  ------------------------------------------------------------

  src/pyuoi/lbfgs/_lowlevel.pyx:400:40: Cannot assign type 'lbfgsfloatval_t (void *, lbfgsconst_p, lbfgsfloatval_t *, int, lbfgsfloatval_t) except? -1' to 'lbfgs_evaluate_t'. Exception values are incompatible. Suggest adding 'noexcept' to type 'lbfgsfloatval_t (void *, lbfgsconst_p, lbfgsfloatval_t *, int, lbfgsfloatval_t) except? -1'.

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
          x_a = aligned_copy(x0.ravel())

          try:
              callback_data = (f, progress, x0.shape, args)
              r = lbfgs(n, x_a, fx_final, call_eval,
                        call_progress, <void *>callback_data, &self.params)
                        ^
  ------------------------------------------------------------

  src/pyuoi/lbfgs/_lowlevel.pyx:401:22: Cannot assign type 'int (void *, lbfgsconst_p, lbfgsconst_p, lbfgsfloatval_t, lbfgsfloatval_t, lbfgsfloatval_t, lbfgsfloatval_t, int, int, int) except? -1' to 'lbfgs_progress_t'. Exception values are incompatible. Suggest adding 'noexcept' to type 'int (void *, lbfgsconst_p, lbfgsconst_p, lbfgsfloatval_t, lbfgsfloatval_t, lbfgsfloatval_t, lbfgsfloatval_t, int, int, int) except? -1'.
  Compiling src/pyuoi/lbfgs/_lowlevel.pyx because it changed.
  [1/1] Cythonizing src/pyuoi/lbfgs/_lowlevel.pyx
  Traceback (most recent call last):
    File "/global/homes/m/mphagen/miniconda3/envs/new_pyuoi_env/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
      main()
    File "/global/homes/m/mphagen/miniconda3/envs/new_pyuoi_env/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/global/homes/m/mphagen/miniconda3/envs/new_pyuoi_env/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
      return hook(config_settings)
             ^^^^^^^^^^^^^^^^^^^^^
    File "/tmp/pip-build-env-yhse78lt/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 355, in get_requires_for_build_wheel
      return self._get_build_requires(config_settings, requirements=['wheel'])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/tmp/pip-build-env-yhse78lt/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 325, in _get_build_requires
      self.run_setup()
    File "/tmp/pip-build-env-yhse78lt/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 341, in run_setup
      exec(code, locals())
    File "<string>", line 37, in <module>
    File "/tmp/pip-build-env-yhse78lt/overlay/lib/python3.12/site-packages/Cython/Build/Dependencies.py", line 1134, in cythonize
      cythonize_one(*args)
    File "/tmp/pip-build-env-yhse78lt/overlay/lib/python3.12/site-packages/Cython/Build/Dependencies.py", line 1301, in cythonize_one
      raise CompileError(None, pyx_file)
  Cython.Compiler.Errors.CompileError: src/pyuoi/lbfgs/_lowlevel.pyx
  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.
  full command: /global/homes/m/mphagen/miniconda3/envs/new_pyuoi_env/bin/python3.12 /global/homes/m/mphagen/miniconda3/envs/new_pyuoi_env/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py get_requires_for_build_wheel /tmp/tmpxnniaewi
  cwd: /global/u1/m/mphagen/software/pyuoi
  Getting requirements to build wheel ... error
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.