[pdal] Build pdal with python 3
Howard Butler
howard at hobu.co
Mon Feb 1 09:43:11 PST 2016
It looks like there is some kind of confusion on your environment. Which compiler and compiler version is being used? We might be assuming if you're on OSX you're using clang. The #include <cstdint> thing might be related to that compiler/version combo, or it might be to some kind of c++11 thing, I'm not sure.
> On Feb 1, 2016, at 11:30 AM, flatearth at gmx.net wrote:
>
> Thanks a lot, the link to your cmake configuration helped. I installed python3 now with Homebrew and set the cmake python variables accordingly. Homebrew installs the most recent version of python 3 which is 3.5.1. It was possible to install pdal via pip also in a Anaconda env with python 3.5.1.
>
> I still don't manage to install pdal python for python 3.4.4 which I prefer to use in my usual Anaconda environment (due to some problems with python 3.5). I tried to set the python pathes to Anaconda in the cmake variables:
>
> -DPYTHON_EXECUTABLE=/Users/me/anaconda/envs/rs/bin/python3 \
> -DPYTHON_LIBRARY=/Users/me/anaconda/envs/rs/lib/libpython3.4m.dylib \
> -DPYTHON_INCLUDE_DIR=/Users/me/anaconda/envs/rs/include/python3.4m \
>
> But when doing 'pip install pdal' from my conda python 3.4.4 environment several errors occur again:
>
> (rs)mac:~ me$ python
> Python 3.4.4 |Anaconda 2.4.0 (x86_64)| (default, Jan 9 2016, 17:30:09)
> [GCC 4.2.1 (Apple Inc. build 5577)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
>>>> quit()
> (rs)mac:~ me$ which pip
> /Users/me/anaconda/envs/rs/bin/pip
> (rs)mac:~ me$ pip install pdal
> Collecting pdal
> Using cached PDAL-1.1.0.zip
> Building wheels for collected packages: pdal
> Running setup.py bdist_wheel for pdal ... error
> Complete output from command /Users/me/anaconda/envs/rs/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/gz/t3r4_mbs2g11gd54w4ksj7xc0020_6/T/pip-build-f68q4kcb/pdal/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /var/folders/gz/t3r4_mbs2g11gd54w4ksj7xc0020_6/T/tmplbj2gl_vpip-wheel- --python-tag cp34:
> running bdist_wheel
> running build
> running build_py
> creating build
> creating build/lib.macosx-10.5-x86_64-3.4
> creating build/lib.macosx-10.5-x86_64-3.4/pdal
> copying pdal/__init__.py -> build/lib.macosx-10.5-x86_64-3.4/pdal
> copying pdal/pipeline_xml.py -> build/lib.macosx-10.5-x86_64-3.4/pdal
> running build_ext
> building 'pdal.libpdalpython' extension
> creating build/temp.macosx-10.5-x86_64-3.4
> creating build/temp.macosx-10.5-x86_64-3.4/pdal
> gcc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/me/anaconda/envs/rs/include -arch x86_64 -I/Users/me/Software/pdal/py34/include -I/usr/local/include -I/usr/local/include -I/usr/local/Cellar/libxml2/2.9.3/include/libxml2 -I/usr/local/include -I/usr/local/include -I/Users/me/anaconda/envs/rs/lib/python3.4/site-packages/numpy/core/include -I/Users/me/anaconda/envs/rs/include/python3.4m -c pdal/libpdalpython.cpp -o build/temp.macosx-10.5-x86_64-3.4/pdal/libpdalpython.o -std=c++11
> In file included from pdal/libpdalpython.cpp:289:
> In file included from /Users/me/anaconda/envs/rs/lib/python3.4/site-packages/numpy/core/include/numpy/arrayobject.h:4:
> In file included from /Users/me/anaconda/envs/rs/lib/python3.4/site-packages/numpy/core/include/numpy/ndarrayobject.h:18:
> In file included from /Users/me/anaconda/envs/rs/lib/python3.4/site-packages/numpy/core/include/numpy/ndarraytypes.h:1781:
> /Users/me/anaconda/envs/rs/lib/python3.4/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
> #warning "Using deprecated NumPy API, disable it by " \
> ^
> In file included from pdal/libpdalpython.cpp:291:
> In file included from /Users/me/Software/pdal/py34/include/pdal/plang/Array.hpp:37:
> In file included from /Users/me/Software/pdal/py34/include/pdal/pdal_internal.hpp:44:
> In file included from /Users/me/Software/pdal/py34/include/pdal/pdal_macros.hpp:38:
> /Users/me/Software/pdal/py34/include/pdal/plugin.hpp:46:10: fatal error: 'cstdint' file not found
> #include <cstdint>
> ^
> 1 warning and 1 error generated.
> error: command 'gcc' failed with exit status 1
>
> ----------------------------------------
> Failed building wheel for pdal
> Running setup.py clean for pdal
> Failed to build pdal
> Installing collected packages: pdal
> Running setup.py install for pdal ... error
> Complete output from command /Users/me/anaconda/envs/rs/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/gz/t3r4_mbs2g11gd54w4ksj7xc0020_6/T/pip-build-f68q4kcb/pdal/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/gz/t3r4_mbs2g11gd54w4ksj7xc0020_6/T/pip-05u3d_lt-record/install-record.txt --single-version-externally-managed --compile:
> running install
> running build
> running build_py
> creating build
> creating build/lib.macosx-10.5-x86_64-3.4
> creating build/lib.macosx-10.5-x86_64-3.4/pdal
> copying pdal/__init__.py -> build/lib.macosx-10.5-x86_64-3.4/pdal
> copying pdal/pipeline_xml.py -> build/lib.macosx-10.5-x86_64-3.4/pdal
> running build_ext
> building 'pdal.libpdalpython' extension
> creating build/temp.macosx-10.5-x86_64-3.4
> creating build/temp.macosx-10.5-x86_64-3.4/pdal
> gcc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/me/anaconda/envs/rs/include -arch x86_64 -I/Users/me/Software/pdal/py34/include -I/usr/local/include -I/usr/local/include -I/usr/local/Cellar/libxml2/2.9.3/include/libxml2 -I/usr/local/include -I/usr/local/include -I/Users/me/anaconda/envs/rs/lib/python3.4/site-packages/numpy/core/include -I/Users/me/anaconda/envs/rs/include/python3.4m -c pdal/libpdalpython.cpp -o build/temp.macosx-10.5-x86_64-3.4/pdal/libpdalpython.o -std=c++11
> In file included from pdal/libpdalpython.cpp:289:
> In file included from /Users/me/anaconda/envs/rs/lib/python3.4/site-packages/numpy/core/include/numpy/arrayobject.h:4:
> In file included from /Users/me/anaconda/envs/rs/lib/python3.4/site-packages/numpy/core/include/numpy/ndarrayobject.h:18:
> In file included from /Users/me/anaconda/envs/rs/lib/python3.4/site-packages/numpy/core/include/numpy/ndarraytypes.h:1781:
> /Users/me/anaconda/envs/rs/lib/python3.4/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
> #warning "Using deprecated NumPy API, disable it by " \
> ^
> In file included from pdal/libpdalpython.cpp:291:
> In file included from /Users/me/Software/pdal/py34/include/pdal/plang/Array.hpp:37:
> In file included from /Users/me/Software/pdal/py34/include/pdal/pdal_internal.hpp:44:
> In file included from /Users/me/Software/pdal/py34/include/pdal/pdal_macros.hpp:38:
> /Users/me/Software/pdal/py34/include/pdal/plugin.hpp:46:10: fatal error: 'cstdint' file not found
> #include <cstdint>
> ^
> 1 warning and 1 error generated.
> error: command 'gcc' failed with exit status 1
>
> ----------------------------------------
> Command "/Users/me/anaconda/envs/rs/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/gz/t3r4_mbs2g11gd54w4ksj7xc0020_6/T/pip-build-f68q4kcb/pdal/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/gz/t3r4_mbs2g11gd54w4ksj7xc0020_6/T/pip-05u3d_lt-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/gz/t3r4_mbs2g11gd54w4ksj7xc0020_6/T/pip-build-f68q4kcb/pdal
>
>
>
> Concerning the manual change of library pathes with 'install_name_tool' I still have to change them with the python 3.5.1 install (as with python 2.7). I changed the CMAKE_INSTALL_PREFIX path to my personal setting and installed pdal to this place. However, the python module is of course installed to the site-package directory of the according python install (if you meant that?).
>
>
>
>
>
>
>
>
> <quote author='Howard Butler-3'>
>
>> On Jan 30, 2016, at 2:58 AM, FE <flatearth at gmx.net> wrote:
>>
>> Hi,
>>
>> I've managed to build pdal 1.1.0 on OS X using cmake-gui and makefiles. It
>> was build with python 2 by default. Python modules installed via 'pip
>> install pdal' work (after several pathes in the libraries have been
>> corrected manually with 'install_name_tool').
>
> Please provide more detail on this one. If you install PDAL to its
> CMAKE_INSTALL_PREFIX path, install_name_tool and stuff should all be done
> for you.
>
>>
>> However, since I work with python 3 I would like to build pdal with python
>> 3 (it seems impossible to install pdal python modules in a python 3
>> environment having pdal build with python 2 -> causes various error
>> messages).
>> Would anybody like to explain how to build pdal with python 3 on OS X? I
>> am not very deep into these techniques and did not manage until now.
>>
>> How can I tell cmake to use python 3? It is unclear to me which python is
>> used by cmake.
>> I have three pythons on the computer. The system python is python 2,
>> Homebrew python is python 2 (and python 3 could be installed easily),
>> finally I use Anaconda with a python 3 environment.
>> Does cmake only requires the python include directories? How to tell cmake
>> which python to use?
>
> We need specific error information and notes about where you had trouble. I
> build PDAL with embedded Python 3 as a normal part of development almost
> daily. See my cmake example configuration at [1] for inspiration.
>
> I do see an error with the Python extension at the moment. It has been fixed
> in https://github.com/PDAL/PDAL/pull/1096 and confirmed to work with Python
> 3 for me.
>
> Howard
>
> [1] https://github.com/PDAL/PDAL/blob/master/cmake/examples/hobu-config.sh
>
> _______________________________________________
> pdal mailing list
> pdal at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/pdal
> </quote>
> Quoted from:
> http://osgeo-org.1560.x6.nabble.com/pdal-Build-pdal-with-python-3-tp5248100p5248128.html
>
> _____________________________________
> Sent from http://osgeo-org.1560.x6.nabble.com
>
More information about the pdal
mailing list