[pdal] compile pdal with Python support

Howard Butler howard at hobu.co
Mon Nov 30 08:33:41 PST 2015


> On Nov 30, 2015, at 9:39 AM, Luca Delucchi <lucadeluge at gmail.com> wrote:
> 
> On 30 November 2015 at 16:16, Howard Butler <howard at hobu.co> wrote:
>> 
>> 
>> Presumably this issue is caused by not having python-devel and numpy-devel packages installed. The cmake numpy detection is not so verbose.
>> 
> 
> We cannot find RPM or Debian packages for numpy-devel, there is only numpy

Ok, this must install as part of numpy then.

> 
>> 
>>> We also try to run "python setup.py build" into python directory but
>>> we got an error "no module packaging.version"
>> 
>> You must use pip or easy_install to install the packaging package:
>> 
>> $ pip install packaging
>> 
>> as a prerequisite before the PDAL Python extension can build/install.
>> 
> 
> done

you may need to install cython too

$ pip install cython



> 
>> Then the following command should work:
>> 
>> $ python setup.py build; python setup.py install
>> 
> 
> we tried but we got this error
> 
> python setup.py build
> Compiling pdal/libpdalpython.pyx because it changed.
> Cythonizing pdal/libpdalpython.pyx
> 
> Error compiling Cython file:
> ------------------------------------------------------------
> ...
> cdef class PyPipeline:
>    cdef Pipeline *thisptr      # hold a c++ instance which we're wrapping
>    def __cinit__(self, unicode xml):
>        cdef char* x
>        if PY_MAJOR_VERSION >= 3:
>            self.thisptr = new Pipeline(xml.encode('UTF-8'))
>                                                 ^
> ------------------------------------------------------------
> 
> pdal/libpdalpython.pyx:28:50: Obtaining 'char const *' from temporary
> Python value
> Traceback (most recent call last):
>  File "setup.py", line 140, in <module>
>    extensions= cythonize(extensions, language="c++")
>  File "/usr/lib64/python2.7/site-packages/Cython/Build/Dependencies.py",
> line 713, in cythonize
>    cythonize_one(*args[1:])
>  File "/usr/lib64/python2.7/site-packages/Cython/Build/Dependencies.py",
> line 780, in cythonize_one
>    raise CompileError(None, pyx_file)
> Cython.Compiler.Errors.CompileError: pdal/libpdalpython.pyx
> 
> There is something strange because we are running Python 2.7.5 but it
> seems to check Python >= 3
> 
> -

One gotcha I can think of is building PDAL against Python 2.x and then building the Python extension using Python 3.x. That scenario definitely will not work.

I wonder if the error you are seeing is due to Cython being missing though. Please try that first.

Howard



More information about the pdal mailing list