uber / h3-py

Python bindings for H3, a hierarchical hexagonal geospatial indexing system
https://uber.github.io/h3-py
Apache License 2.0
834 stars 132 forks source link

Compiling from source #262

Open atbdeveloper opened 2 years ago

atbdeveloper commented 2 years ago

Hi everyone, I have this issue trying to compile from source. So I have a question: Do you have compile instructions?

Command for compile and install:

python3 setup.py install

and it returns this error:

[ 83%] Built target edges [ 86%] Generating C source src/h3/_cy/to_multipoly.c [ 89%] Building C object src/h3/_cy/CMakeFiles/to_multipoly.dir/to_multipoly.c.o /home/adrian/h3-py/_skbuild/linux-x86_64-3.8/cmake-build/src/h3/_cy/to_multipoly.c:1666:1: warning: parameter names (without types) in function declaration 1666 | static PyObject pyx_converttopypyx_ctuple_double__and_double(pyx_ctuple_double__and_double); | ^~ /home/adrian/h3-py/_skbuild/linux-x86_64-3.8/cmake-build/src/h3/_cy/to_multipoly.c:1811:41: error: expected declaration specifiers or ‘...’ before ‘’ token 1811 | static pyx_ctuple_doubleand_double (__pyx_f_2h3_3_cy_4util_coord2deg)(GeoCoord); /proto*/ | ^ /home/adrian/h3-py/_skbuild/linux-x86_64-3.8/cmake-build/src/h3/_cy/to_multipoly.c: In function ‘pyx_f_2h3_3_cy_12to_multipoly_walk_coords’: /home/adrian/h3-py/_skbuild/linux-x86_64-3.8/cmake-build/src/h3/_cy/to_multipoly.c:2419:70: warning: implicit declaration of function ‘pyx_f_2h3_3_cy_4util_coord2deg’; did you mean ‘pyx_f_2h3_3_cy_4util_check_cell’? [-Wimplicit-function-declaration] 2419 | pyx_t_1 = pyx_convertto_py_pyx_ctuple_double__and_double(pyx_f_2h3_3_cy_4util_coord2deg(pyx_v_L->vertex)); if (unlikely(!pyx_t_1)) PYX_ERR(0, 29, pyx_L1_error) | ^~~~~~~~ | pyx_f_2h3_3_cy_4util_check_cell /home/adrian/h3-py/_skbuild/linux-x86_64-3.8/cmake-build/src/h3/_cy/to_multipoly.c: In function ‘Pyx_modinit_function_import_code’: /home/adrian/h3-py/_skbuild/linux-x86_64-3.8/cmake-build/src/h3/_cy/to_multipoly.c:17381:70: error: ‘pyx_f_2h3_3_cy_4util_coord2deg’ undeclared (first use in this function); did you mean ‘pyx_f_2h3_3_cy_4util_check_cell’? 17381 | if (Pyx_ImportFunction(pyx_t_1, "coord2deg", (void (**)(void))&pyx_f_2h3_3_cy_4util_coord2deg, "pyx_ctuple_doubleand_double (GeoCoord)") < 0) PYX_ERR(0, 1, pyx_L1_error) | ^~~~~~~~ | pyx_f_2h3_3_cy_4util_check_cell /home/adrian/h3-py/_skbuild/linux-x86_64-3.8/cmake-build/src/h3/_cy/to_multipoly.c:17381:70: note: each undeclared identifier is reported only once for each function it appears in /home/adrian/h3-py/_skbuild/linux-x86_64-3.8/cmake-build/src/h3/_cy/to_multipoly.c: At top level: /home/adrian/h3-py/_skbuild/linux-x86_64-3.8/cmake-build/src/h3/_cy/to_multipoly.c:20812:73: error: unknown type name ‘pyx_ctuple_doubleand_double’ 20812 | static PyObject pyx_converttopypyx_ctuple_double__and_double(pyx_ctuple_doubleand_double value) { | ^~~~~~~ /home/adrian/h3-py/_skbuild/linux-x86_64-3.8/cmake-build/src/h3/_cy/to_multipoly.c:1666:18: warning: ‘__pyx_convertto_py_pyx_ctuple_doubleand_double’ used but never defined 1666 | static PyObject pyx_converttopypyx_ctuple_double__and_double(pyx_ctuple_double__and_double); | ^~~~~~~~~~~~ make[2]: [src/h3/_cy/CMakeFiles/to_multipoly.dir/build.make:81: src/h3/_cy/CMakeFiles/to_multipoly.dir/to_multipoly.c.o] Error 1 make[1]: [CMakeFiles/Makefile2:407: src/h3/_cy/CMakeFiles/to_multipoly.dir/all] Error 2 make: *** [Makefile:156: all] Error 2 Traceback (most recent call last): File "/home/adrian/.local/lib/python3.8/site-packages/skbuild/setuptools_wrap.py", line 645, in setup cmkr.make(make_args, install_target=cmake_install_target, env=env)

atbdeveloper commented 2 years ago

I've tried with V4 and still getting this error:

[ 93%] Generating C source src/h3/_cy/to_multipoly.c [ 96%] Building C object src/h3/_cy/CMakeFiles/to_multipoly.dir/to_multipoly.c.o /home/adrian/test/h3-py/_skbuild/linux-x86_64-3.8/cmake-build/src/h3/_cy/to_multipoly.c:1692:1: warning: parameter names (without types) in function declaration 1692 | static PyObject pyx_converttopypyx_ctuple_double__and_double(pyx_ctuple_double__and_double); | ^~ /home/adrian/test/h3-py/_skbuild/linux-x86_64-3.8/cmake-build/src/h3/_cy/to_multipoly.c:1835:41: error: expected declaration specifiers or ‘...’ before ‘’ token 1835 | static pyx_ctuple_doubleand_double (__pyx_f_2h3_3_cy_4util_coord2deg)(LatLng); /proto*/ | ^ /home/adrian/test/h3-py/_skbuild/linux-x86_64-3.8/cmake-build/src/h3/_cy/to_multipoly.c: In function ‘pyx_f_2h3_3_cy_12to_multipoly_walk_coords’: /home/adrian/test/h3-py/_skbuild/linux-x86_64-3.8/cmake-build/src/h3/_cy/to_multipoly.c:2443:70: warning: implicit declaration of function ‘pyx_f_2h3_3_cy_4util_coord2deg’; did you mean ‘pyx_f_2h3_3_cy_4util_check_cell’? [-Wimplicit-function-declaration] 2443 | pyx_t_1 = pyx_convertto_py_pyx_ctuple_double__and_double(pyx_f_2h3_3_cy_4util_coord2deg(pyx_v_L->vertex)); if (unlikely(!pyx_t_1)) PYX_ERR(0, 29, pyx_L1_error) | ^~~~~~~~ | pyx_f_2h3_3_cy_4util_check_cell /home/adrian/test/h3-py/_skbuild/linux-x86_64-3.8/cmake-build/src/h3/_cy/to_multipoly.c: In function ‘Pyx_modinit_function_import_code’: /home/adrian/test/h3-py/_skbuild/linux-x86_64-3.8/cmake-build/src/h3/_cy/to_multipoly.c:17405:70: error: ‘pyx_f_2h3_3_cy_4util_coord2deg’ undeclared (first use in this function); did you mean ‘pyx_f_2h3_3_cy_4util_check_cell’? 17405 | if (Pyx_ImportFunction(pyx_t_1, "coord2deg", (void (**)(void))&pyx_f_2h3_3_cy_4util_coord2deg, "pyx_ctuple_doubleand_double (LatLng)") < 0) PYX_ERR(0, 1, pyx_L1_error) | ^~~~~~~~ | pyx_f_2h3_3_cy_4util_check_cell /home/adrian/test/h3-py/_skbuild/linux-x86_64-3.8/cmake-build/src/h3/_cy/to_multipoly.c:17405:70: note: each undeclared identifier is reported only once for each function it appears in /home/adrian/test/h3-py/_skbuild/linux-x86_64-3.8/cmake-build/src/h3/_cy/to_multipoly.c: At top level: /home/adrian/test/h3-py/_skbuild/linux-x86_64-3.8/cmake-build/src/h3/_cy/to_multipoly.c:20836:73: error: unknown type name ‘pyx_ctuple_doubleand_double’ 20836 | static PyObject pyx_converttopypyx_ctuple_double__and_double(pyx_ctuple_doubleand_double value) { | ^~~~~~~ /home/adrian/test/h3-py/_skbuild/linux-x86_64-3.8/cmake-build/src/h3/_cy/to_multipoly.c:1692:18: warning: ‘__pyx_convertto_py_pyx_ctuple_doubleand_double’ used but never defined 1692 | static PyObject pyx_converttopypyx_ctuple_double__and_double(pyx_ctuple_double__and_double); | ^~~~~~~~~~~~ make[2]: [src/h3/_cy/CMakeFiles/to_multipoly.dir/build.make:81: src/h3/_cy/CMakeFiles/to_multipoly.dir/to_multipoly.c.o] Error 1 make[1]: [CMakeFiles/Makefile2:350: src/h3/_cy/CMakeFiles/to_multipoly.dir/all] Error 2 make: *** [Makefile:156: all] Error 2 Traceback (most recent call last): File "/home/adrian/.local/lib/python3.8/site-packages/skbuild/setuptools_wrap.py", line 645, in setup cmkr.make(make_args, install_target=cmake_install_target, env=env) File "/home/adrian/.local/lib/python3.8/site-packages/skbuild/cmaker.py", line 680, in make self.make_impl(clargs=clargs, config=config, source_dir=source_dir, install_target=install_target, env=env) File "/home/adrian/.local/lib/python3.8/site-packages/skbuild/cmaker.py", line 704, in make_impl raise SKBuildError(

An error occurred while building with CMake. Command: cmake --build . --target install --config Release -- Install target: install Source directory: /home/adrian/test/h3-py Working directory: /home/adrian/test/h3-py/_skbuild/linux-x86_64-3.8/cmake-build Please check the install target is valid and see CMake's output for more information. ➜ h3-py git:(dev_v4) ✗

ajfriend commented 2 years ago

Do you get the same error installing from source with pip? (Check out the makefile for how I typically do that locally)

atbdeveloper commented 2 years ago

I wanna install from source because I'm making tests with openmp for speedup polyfill function. Makefile method returns same error. Do you have any tutorial for compiling?

kylebarron commented 2 years ago

The compilation instructions are in https://github.com/uber/h3-py/blob/master/dev_notes.md. Other than python setup.py install in the first issue, you haven't described what commands you're running, what environment you're running them in, and your package versions. It wouldn't be surprising if your versions of skbuild or cython were just too old.