hichamjanati / mtw

Wasserstein regularization for sparse multi-task regression
BSD 3-Clause "New" or "Revised" License
15 stars 6 forks source link

Cython compilation errors #10

Open arokem opened 4 years ago

arokem commented 4 years ago

Hello -- thank you for making this project available.

I am running into some trouble trying to build and compile this:

(mtw) mtw (pep518)$pip install --no-deps -e . 
  WARNING: Missing build requirements in pyproject.toml for file:///Users/arokem/source/mtw.
  WARNING: The project does not specify a build backend, and pip cannot fall back to setuptools without 'wheel'.
open errors.tx  ERROR: Command errored out with exit status 1:
   command: /Users/arokem/.virtualenvs/mtw/bin/python3.7 /Users/arokem/.virtualenvs/mtw/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /var/folders/56/4s8_k8_s2n9c1622_bmnz7m40000gn/T/tmpjvb234qh
       cwd: /Users/arokem/source/mtw
  Complete output (1412 lines):
  /private/var/folders/56/4s8_k8_s2n9c1622_bmnz7m40000gn/T/pip-build-env-w7qtokj_/overlay/lib/python3.7/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /Users/arokem/source/mtw/mtw/solver_cd.pyx
    tree = Parsing.p_module(s, pxd, full_module_name)

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cimport cython
  cimport numpy as np
  import numpy as np
  from cython cimport floating
  from libc.math cimport fabs, sqrt, fmax
  from scipy.linalg.cython_blas cimport ddot, dasum, daxpy, dnrm2, dcopy, dscal
  ^
  ------------------------------------------------------------

  mtw/solver_cd.pyx:6:0: 'scipy/linalg/cython_blas.pxd' not found

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cimport cython
  cimport numpy as np
  import numpy as np
  from cython cimport floating
  from libc.math cimport fabs, sqrt, fmax
  from scipy.linalg.cython_blas cimport ddot, dasum, daxpy, dnrm2, dcopy, dscal
  ^
  ------------------------------------------------------------

  mtw/solver_cd.pyx:6:0: 'scipy/linalg/cython_blas/ddot.pxd' not found

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cimport cython
  cimport numpy as np
  import numpy as np
  from cython cimport floating
  from libc.math cimport fabs, sqrt, fmax
  from scipy.linalg.cython_blas cimport ddot, dasum, daxpy, dnrm2, dcopy, dscal
  ^
  ------------------------------------------------------------

  mtw/solver_cd.pyx:6:0: 'scipy/linalg/cython_blas/dasum.pxd' not found

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cimport cython
  cimport numpy as np
  import numpy as np
  from cython cimport floating
  from libc.math cimport fabs, sqrt, fmax
  from scipy.linalg.cython_blas cimport ddot, dasum, daxpy, dnrm2, dcopy, dscal
  ^
  ------------------------------------------------------------

  mtw/solver_cd.pyx:6:0: 'scipy/linalg/cython_blas/daxpy.pxd' not found

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cimport cython
  cimport numpy as np
  import numpy as np
  from cython cimport floating
  from libc.math cimport fabs, sqrt, fmax
  from scipy.linalg.cython_blas cimport ddot, dasum, daxpy, dnrm2, dcopy, dscal
  ^
  ------------------------------------------------------------

  mtw/solver_cd.pyx:6:0: 'scipy/linalg/cython_blas/dnrm2.pxd' not found

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cimport cython
  cimport numpy as np
  import numpy as np
  from cython cimport floating
  from libc.math cimport fabs, sqrt, fmax
  from scipy.linalg.cython_blas cimport ddot, dasum, daxpy, dnrm2, dcopy, dscal
  ^
  ------------------------------------------------------------

  mtw/solver_cd.pyx:6:0: 'scipy/linalg/cython_blas/dcopy.pxd' not found

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cimport cython
  cimport numpy as np
  import numpy as np
  from cython cimport floating
  from libc.math cimport fabs, sqrt, fmax
  from scipy.linalg.cython_blas cimport ddot, dasum, daxpy, dnrm2, dcopy, dscal
  ^
  ------------------------------------------------------------

  mtw/solver_cd.pyx:6:0: 'scipy/linalg/cython_blas/dscal.pxd' not found

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cimport numpy as np
  import numpy as np
  from cython cimport floating
  from libc.math cimport fabs, sqrt, fmax
  from scipy.linalg.cython_blas cimport ddot, dasum, daxpy, dnrm2, dcopy, dscal
  from scipy.linalg.cython_blas cimport sdot, sasum, saxpy, snrm2, scopy, sscal
  ^
  ------------------------------------------------------------

  mtw/solver_cd.pyx:7:0: 'scipy/linalg/cython_blas/sdot.pxd' not found

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cimport numpy as np
  import numpy as np
  from cython cimport floating
  from libc.math cimport fabs, sqrt, fmax
  from scipy.linalg.cython_blas cimport ddot, dasum, daxpy, dnrm2, dcopy, dscal
  from scipy.linalg.cython_blas cimport sdot, sasum, saxpy, snrm2, scopy, sscal
  ^
  ------------------------------------------------------------

  mtw/solver_cd.pyx:7:0: 'scipy/linalg/cython_blas/sasum.pxd' not found

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cimport numpy as np
  import numpy as np
  from cython cimport floating
  from libc.math cimport fabs, sqrt, fmax
  from scipy.linalg.cython_blas cimport ddot, dasum, daxpy, dnrm2, dcopy, dscal
  from scipy.linalg.cython_blas cimport sdot, sasum, saxpy, snrm2, scopy, sscal
  ^
  ------------------------------------------------------------

  mtw/solver_cd.pyx:7:0: 'scipy/linalg/cython_blas/saxpy.pxd' not found

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cimport numpy as np
  import numpy as np
  from cython cimport floating
  from libc.math cimport fabs, sqrt, fmax
  from scipy.linalg.cython_blas cimport ddot, dasum, daxpy, dnrm2, dcopy, dscal
  from scipy.linalg.cython_blas cimport sdot, sasum, saxpy, snrm2, scopy, sscal
  ^
  ------------------------------------------------------------

  mtw/solver_cd.pyx:7:0: 'scipy/linalg/cython_blas/snrm2.pxd' not found

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cimport numpy as np
  import numpy as np
  from cython cimport floating
  from libc.math cimport fabs, sqrt, fmax
  from scipy.linalg.cython_blas cimport ddot, dasum, daxpy, dnrm2, dcopy, dscal
  from scipy.linalg.cython_blas cimport sdot, sasum, saxpy, snrm2, scopy, sscal
  ^
  ------------------------------------------------------------

  mtw/solver_cd.pyx:7:0: 'scipy/linalg/cython_blas/scopy.pxd' not found

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cimport numpy as np
  import numpy as np
  from cython cimport floating
  from libc.math cimport fabs, sqrt, fmax
  from scipy.linalg.cython_blas cimport ddot, dasum, daxpy, dnrm2, dcopy, dscal
  from scipy.linalg.cython_blas cimport sdot, sasum, saxpy, snrm2, scopy, sscal
  ^
  ------------------------------------------------------------

  mtw/solver_cd.pyx:7:0: 'scipy/linalg/cython_blas/sscal.pxd' not found

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cdef floating fdot(int * n, floating * x, int * inc1, floating * y,
                          int * inc2) nogil:
      if floating is double:
          return ddot(n, x, inc1, y, inc2)
      else:
          return sdot(n, x, inc1, y, inc2)
                ^
  ------------------------------------------------------------

  mtw/solver_cd.pyx:23:15: 'sdot' is not a constant, variable or function identifier

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cdef floating fdot(int * n, floating * x, int * inc1, floating * y,
                          int * inc2) nogil:
      if floating is double:
          return ddot(n, x, inc1, y, inc2)
      else:
          return sdot(n, x, inc1, y, inc2)
                     ^
  ------------------------------------------------------------

  mtw/solver_cd.pyx:23:20: Cannot convert 'int *' to Python object

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cdef floating fdot(int * n, floating * x, int * inc1, floating * y,
                          int * inc2) nogil:
      if floating is double:
          return ddot(n, x, inc1, y, inc2)
      else:
          return sdot(n, x, inc1, y, inc2)
                        ^
  ------------------------------------------------------------

  mtw/solver_cd.pyx:23:23: Cannot convert 'float *' to Python object

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cdef floating fdot(int * n, floating * x, int * inc1, floating * y,
                          int * inc2) nogil:
      if floating is double:
          return ddot(n, x, inc1, y, inc2)
      else:
          return sdot(n, x, inc1, y, inc2)
                           ^
  ------------------------------------------------------------

  mtw/solver_cd.pyx:23:26: Cannot convert 'int *' to Python object

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cdef floating fdot(int * n, floating * x, int * inc1, floating * y,
                          int * inc2) nogil:
      if floating is double:
          return ddot(n, x, inc1, y, inc2)
      else:
          return sdot(n, x, inc1, y, inc2)
                                 ^
  ------------------------------------------------------------

  mtw/solver_cd.pyx:23:32: Cannot convert 'float *' to Python object

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cdef floating fdot(int * n, floating * x, int * inc1, floating * y,
                          int * inc2) nogil:
      if floating is double:
          return ddot(n, x, inc1, y, inc2)
      else:
          return sdot(n, x, inc1, y, inc2)
                                    ^
  ------------------------------------------------------------

  mtw/solver_cd.pyx:23:35: Cannot convert 'int *' to Python object

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
          return -1.0

  cdef floating fdot(int * n, floating * x, int * inc1, floating * y,
                          int * inc2) nogil:
      if floating is double:
          return ddot(n, x, inc1, y, inc2)
                ^
  ------------------------------------------------------------

  mtw/solver_cd.pyx:21:15: 'ddot' is not a constant, variable or function identifier

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
          return -1.0

  cdef floating fdot(int * n, floating * x, int * inc1, floating * y,
                          int * inc2) nogil:
      if floating is double:
          return ddot(n, x, inc1, y, inc2)
                     ^
  ------------------------------------------------------------

  mtw/solver_cd.pyx:21:20: Cannot convert 'int *' to Python object

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
          return -1.0

  cdef floating fdot(int * n, floating * x, int * inc1, floating * y,
                          int * inc2) nogil:
      if floating is double:
          return ddot(n, x, inc1, y, inc2)
                        ^
  ------------------------------------------------------------

  mtw/solver_cd.pyx:21:23: Cannot convert 'double *' to Python object

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
          return -1.0

  cdef floating fdot(int * n, floating * x, int * inc1, floating * y,
                          int * inc2) nogil:
      if floating is double:
          return ddot(n, x, inc1, y, inc2)
                           ^
  ------------------------------------------------------------

  mtw/solver_cd.pyx:21:26: Cannot convert 'int *' to Python object

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
          return -1.0

  cdef floating fdot(int * n, floating * x, int * inc1, floating * y,
                          int * inc2) nogil:
      if floating is double:
          return ddot(n, x, inc1, y, inc2)
                 ...
arokem commented 4 years ago

Further info: this is on a mac laptop with clang, installing on a clean env with nothing on it, and with the addition of pyproject file (per #11) to avoid issues with install order (the setup file includes imports from cython and bumpy)

arokem commented 4 years ago

Looks like https://github.com/hichamjanati/mtw/pull/11/commits/1a07fb1411b6b3ab4fbbf9e9128e6713febb2289 resolves this, together with #11

hichamjanati commented 4 years ago

Thanks @arokem !