Rosemeis / HaploNet

Haplotype and population structure inference using neural networks.
GNU General Public License v3.0
26 stars 4 forks source link

Errors building cython #5

Open BrendanRitter opened 3 months ago

BrendanRitter commented 3 months ago

When attempting to install this library, I ran into cython build errors when doing pip3 install -e . It seems like the commit made on Dec 2023 introduced the following code:

cpdef void setupF(float[:,:,::1] L, double[:,:,::1] F, double[:,:,::1] F_new, \
        int[::1] Q_anc, int K) nogil:
    cdef:
        int W = L.shape[0]
        int N = L.shape[1]
        int C = L.shape[2]
        int w, c, k, n
        double sumY
    for w in range(W)
        for k in range(K):

In that for loop, there seems to be a colon missing, leading to the following error:

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
              int W = L.shape[0]
              int N = L.shape[1]
              int C = L.shape[2]
              int w, c, k, n
              double sumY
      for w in range(W)
                    ^
  ------------------------------------------------------------

  haplonet/shared_cy.pyx:84:18: Expected ':', found 'NEWLINE'
  Compiling haplonet/shared_cy.pyx because it changed.
  Compiling haplonet/lahmm_cy.pyx because it changed.
  [1/2] Cythonizing haplonet/lahmm_cy.pyx
  [2/2] Cythonizing haplonet/shared_cy.pyx
  Traceback (most recent call last):
    File "/home/ubuntu/micromamba/envs/pipeline/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
      main()
    File "/home/ubuntu/micromamba/envs/pipeline/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 "/home/ubuntu/micromamba/envs/pipeline/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 132, in get_requires_for_build_editable
      return hook(config_settings)
    File "/tmp/pip-build-env-qbqppf8y/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 458, in get_requires_for_build_editable
      return self.get_requires_for_build_wheel(config_settings)
    File "/tmp/pip-build-env-qbqppf8y/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 "/tmp/pip-build-env-qbqppf8y/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 297, in _get_build_requires
      self.run_setup()
    File "/tmp/pip-build-env-qbqppf8y/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 313, in run_setup
      exec(code, locals())
    File "<string>", line 42, in <module>
    File "/tmp/pip-build-env-qbqppf8y/overlay/lib/python3.9/site-packages/Cython/Build/Dependencies.py", line 1154, in cythonize
      cythonize_one(*args)
    File "/tmp/pip-build-env-qbqppf8y/overlay/lib/python3.9/site-packages/Cython/Build/Dependencies.py", line 1321, in cythonize_one
      raise CompileError(None, pyx_file)
  Cython.Compiler.Errors.CompileError: haplonet/shared_cy.pyx
  [end of output]
Rosemeis commented 3 months ago

Fixed now! Thank you for pointing it out!