0

I'm having trouble building PIRT (Python Image Registration Toolkit library). I have downloaded from bitbucket using mercurial (hg clone https://bitbucket.org/almarklein/pirt). But when I try to build it using python setup.py I get the following error:

Compiling pirt/splinegrid_.pyx because it changed.
[1/2] Cythonizing pirt/interp/interpolation_.pyx

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

    # Methods
    cdef void calculate_lut(self, spline_type, int N)
    cdef double* get_coef(self, double t) nogil
    cdef double* get_coef_from_index(self, int i)    
    cdef double spline_type_to_id(self, spline_type)
                                ^
------------------------------------------------------------

pirt/interp/interpolation_.pxd:23:33: C method 'spline_type_to_id' is declared but not defined
Traceback (most recent call last):
  File "setup.py", line 49, in <module>
    extensions = cythonize(extensions)
  File "/home/osboxes/anaconda3/lib/python3.5/site-packages/Cython/Build/Dependencies.py", line 877, in cythonize
    cythonize_one(*args)
  File "/home/osboxes/anaconda3/lib/python3.5/site-packages/Cython/Build/Dependencies.py", line 997, in cythonize_one
    raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: pirt/interp/interpolation_.pyx

I have Cython and visvis already installed (through Anaconda) but building still fails.

Luke Taylor
  • 8,631
  • 8
  • 54
  • 92
decipher
  • 498
  • 2
  • 4
  • 16

1 Answers1

1

Unfortunately, I couldn't find documentation on what exact part of the functions should be declared in .pxd files. Thankfully, one can view the existing ones in Cython/Includes and draw conclusions.

In short, change the definition in pirt/interp/interpolation_.pxd from:

cdef double spline_type_to_id(self, spline_type)

to:

cdef double spline_type_to_id(self, spline_type) except *

and run setup.py again.

Dimitris Fasarakis Hilliard
  • 150,925
  • 31
  • 268
  • 253