vioshyvo / mrpt

Fast and lightweight header-only C++ library (with Python bindings) for approximate nearest neighbor search
MIT License
257 stars 47 forks source link

Install no longer works with python 3.9 #19

Open sgpinkus opened 3 months ago

sgpinkus commented 3 months ago

I clone repo and:

diff --git a/Dockerfile b/Dockerfile
index 2b2457f..5b78c81 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-FROM python:3.7
+FROM python:3.9

Build fails. I think this might be reason for issue others have reported. Works in python 3.8. Error log below.


 => ERROR [6/6] RUN pip install .                                                                                                                                             28.1s 
------                                                                                                                                                                              
 > [6/6] RUN pip install .:                                                                                                                                                         
#5 0.406 Processing /app                                                                                                                                                            
#5 0.406   Preparing metadata (setup.py): started                                                                                                                                   
#5 5.644   Preparing metadata (setup.py): finished with status 'done'                                                                                                               
#5 5.939 Collecting numpy>=1.10.0 (from mrpt==1.0)                                                                                                                                  
#5 20.98   WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f113bc46e50>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /packages/b1/e3/24d289c5a3255bf52824bd52295e9a7923cad8ae5ec29539fc971e1122f6/numpy-2.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata
#5 21.10   Downloading numpy-2.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (60 kB)
#5 21.14      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 60.9/60.9 kB 1.5 MB/s eta 0:00:00
#5 21.18 Downloading numpy-2.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (19.5 MB)
#5 25.75    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 19.5/19.5 MB 4.8 MB/s eta 0:00:00
#5 25.79 Building wheels for collected packages: mrpt
#5 25.79   Building wheel for mrpt (setup.py): started
#5 27.76   Building wheel for mrpt (setup.py): finished with status 'error'
#5 27.77   error: subprocess-exited-with-error
#5 27.77   
#5 27.77   × python setup.py bdist_wheel did not run successfully.
#5 27.77   │ exit code: 1
#5 27.77   ╰─> [193 lines of output]
#5 27.77       WARNING: '.' not a valid package name; please use only .-separated package names in setup.py
#5 27.77       running bdist_wheel
#5 27.77       running build
#5 27.77       running build_py
#5 27.77       package init file '__init__.py' not found (or not a regular file)
#5 27.77       creating build
#5 27.77       creating build/lib.linux-x86_64-3.9
#5 27.77       copying x.py -> build/lib.linux-x86_64-3.9
#5 27.77       copying mrpt.py -> build/lib.linux-x86_64-3.9
#5 27.77       running build_ext
#5 27.77       building 'mrptlib' extension
#5 27.77       creating build/temp.linux-x86_64-3.9
#5 27.77       creating build/temp.linux-x86_64-3.9/cpp
#5 27.77       gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -Icpp/lib -I/app/.eggs/numpy-2.0.1-py3.9-linux-x86_64.egg/numpy/_core/include -I/usr/local/include/python3.9 -c cpp/mrptmodule.cpp -o build/temp.linux-x86_64-3.9/cpp/mrptmodule.o -march=native -std=c++14 -Ofast -DNDEBUG -fopenmp
#5 27.77       In file included from /app/.eggs/numpy-2.0.1-py3.9-linux-x86_64.egg/numpy/_core/include/numpy/ndarraytypes.h:1909,
#5 27.77                        from /app/.eggs/numpy-2.0.1-py3.9-linux-x86_64.egg/numpy/_core/include/numpy/ndarrayobject.h:12,
#5 27.77                        from /app/.eggs/numpy-2.0.1-py3.9-linux-x86_64.egg/numpy/_core/include/numpy/arrayobject.h:5,
#5 27.77                        from cpp/mrptmodule.cpp:20:
#5 27.77       /app/.eggs/numpy-2.0.1-py3.9-linux-x86_64.egg/numpy/_core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#5 27.77          17 | #warning "Using deprecated NumPy API, disable it with " \
#5 27.77             |  ^~~~~~~
#5 27.77       cpp/mrptmodule.cpp: In function ‘int Mrpt_init(mrptIndex*, PyObject*)’:
#5 27.77       cpp/mrptmodule.cpp:137:55: error: cannot convert ‘PyObject*’ {aka ‘_object*’} to ‘const PyArrayObject*’ {aka ‘const tagPyArrayObject_fields*’}
#5 27.77         137 |         data = reinterpret_cast<float *>(PyArray_DATA(py_data));
#5 27.77             |                                                       ^~~~~~~
#5 27.77             |                                                       |
#5 27.77             |                                                       PyObject* {aka _object*}
#5 27.77       /app/.eggs/numpy-2.0.1-py3.9-linux-x86_64.egg/numpy/_core/include/numpy/ndarraytypes.h:1508:35: note:   initializing argument 1 of ‘void* PyArray_DATA(const PyArrayObject*)’
#5 27.77        1508 | PyArray_DATA(const PyArrayObject *arr)
#5 27.77             |              ~~~~~~~~~~~~~~~~~~~~~^~~
#5 27.77       cpp/mrptmodule.cpp: In function ‘PyObject* build_autotune(mrptIndex*, PyObject*)’:
#5 27.77       cpp/mrptmodule.cpp:199:55: error: cannot convert ‘PyObject*’ {aka ‘_object*’} to ‘const PyArrayObject*’ {aka ‘const tagPyArrayObject_fields*’}
#5 27.77         199 |         data = reinterpret_cast<float *>(PyArray_DATA(py_data));
#5 27.77             |                                                       ^~~~~~~
#5 27.77             |                                                       |
#5 27.77             |                                                       PyObject* {aka _object*}
#5 27.77       /app/.eggs/numpy-2.0.1-py3.9-linux-x86_64.egg/numpy/_core/include/numpy/ndarraytypes.h:1508:35: note:   initializing argument 1 of ‘void* PyArray_DATA(const PyArrayObject*)’
#5 27.77        1508 | PyArray_DATA(const PyArrayObject *arr)
#5 27.77             |              ~~~~~~~~~~~~~~~~~~~~~^~~
#5 27.77       cpp/mrptmodule.cpp: In function ‘PyObject* ann(mrptIndex*, PyObject*)’:
#5 27.77       cpp/mrptmodule.cpp:279:60: error: cannot convert ‘PyObject*’ {aka ‘_object*’} to ‘const PyArrayObject*’ {aka ‘const tagPyArrayObject_fields*’}
#5 27.77         279 |     float *indata = reinterpret_cast<float *>(PyArray_DATA(v));
#5 27.77             |                                                            ^
#5 27.77             |                                                            |
#5 27.77             |                                                            PyObject* {aka _object*}
#5 27.77       /app/.eggs/numpy-2.0.1-py3.9-linux-x86_64.egg/numpy/_core/include/numpy/ndarraytypes.h:1508:35: note:   initializing argument 1 of ‘void* PyArray_DATA(const PyArrayObject*)’
#5 27.77        1508 | PyArray_DATA(const PyArrayObject *arr)
#5 27.77             |              ~~~~~~~~~~~~~~~~~~~~~^~~
#5 27.77       cpp/mrptmodule.cpp:288:22: error: cannot convert ‘PyObject*’ {aka ‘_object*’} to ‘const PyArrayObject*’ {aka ‘const tagPyArrayObject_fields*’}
#5 27.77         288 |     if (PyArray_NDIM(v) == 1) {
#5 27.77             |                      ^
#5 27.77             |                      |
#5 27.77             |                      PyObject* {aka _object*}
#5 27.77       /app/.eggs/numpy-2.0.1-py3.9-linux-x86_64.egg/numpy/_core/include/numpy/ndarraytypes.h:1502:35: note:   initializing argument 1 of ‘int PyArray_NDIM(const PyArrayObject*)’
#5 27.77        1502 | PyArray_NDIM(const PyArrayObject *arr)
#5 27.77             |              ~~~~~~~~~~~~~~~~~~~~~^~~
#5 27.77       cpp/mrptmodule.cpp:289:27: error: cannot convert ‘PyObject*’ {aka ‘_object*’} to ‘const PyArrayObject*’ {aka ‘const tagPyArrayObject_fields*’}
#5 27.77         289 |         dim = PyArray_DIM(v, 0);
#5 27.77             |                           ^
#5 27.77             |                           |
#5 27.77             |                           PyObject* {aka _object*}
#5 27.77       /app/.eggs/numpy-2.0.1-py3.9-linux-x86_64.egg/numpy/_core/include/numpy/ndarraytypes.h:1532:34: note:   initializing argument 1 of ‘npy_intp PyArray_DIM(const PyArrayObject*, int)’
#5 27.77        1532 | PyArray_DIM(const PyArrayObject *arr, int idim)
#5 27.77             |             ~~~~~~~~~~~~~~~~~~~~~^~~
#5 27.77       cpp/mrptmodule.cpp:293:61: error: cannot convert ‘PyObject*’ {aka ‘_object*’} to ‘const PyArrayObject*’ {aka ‘const tagPyArrayObject_fields*’}
#5 27.77         293 |         int *outdata = reinterpret_cast<int *>(PyArray_DATA(nearest));
#5 27.77             |                                                             ^~~~~~~
#5 27.77             |                                                             |
#5 27.77             |                                                             PyObject* {aka _object*}
#5 27.77       /app/.eggs/numpy-2.0.1-py3.9-linux-x86_64.egg/numpy/_core/include/numpy/ndarraytypes.h:1508:35: note:   initializing argument 1 of ‘void* PyArray_DATA(const PyArrayObject*)’
#5 27.77        1508 | PyArray_DATA(const PyArrayObject *arr)
#5 27.77             |              ~~~~~~~~~~~~~~~~~~~~~^~~
#5 27.77       cpp/mrptmodule.cpp:297:75: error: cannot convert ‘PyObject*’ {aka ‘_object*’} to ‘const PyArrayObject*’ {aka ‘const tagPyArrayObject_fields*’}
#5 27.77         297 |             float *out_distances = reinterpret_cast<float *>(PyArray_DATA(distances));
#5 27.77             |                                                                           ^~~~~~~~~
#5 27.77             |                                                                           |
#5 27.77             |                                                                           PyObject* {aka _object*}
#5 27.77       /app/.eggs/numpy-2.0.1-py3.9-linux-x86_64.egg/numpy/_core/include/numpy/ndarraytypes.h:1508:35: note:   initializing argument 1 of ‘void* PyArray_DATA(const PyArrayObject*)’
#5 27.77        1508 | PyArray_DATA(const PyArrayObject *arr)
#5 27.77             |              ~~~~~~~~~~~~~~~~~~~~~^~~
#5 27.77       cpp/mrptmodule.cpp:309:25: error: cannot convert ‘PyObject*’ {aka ‘_object*’} to ‘const PyArrayObject*’ {aka ‘const tagPyArrayObject_fields*’}
#5 27.77         309 |         n = PyArray_DIM(v, 0);
#5 27.77             |                         ^
#5 27.77             |                         |
#5 27.77             |                         PyObject* {aka _object*}
#5 27.77       /app/.eggs/numpy-2.0.1-py3.9-linux-x86_64.egg/numpy/_core/include/numpy/ndarraytypes.h:1532:34: note:   initializing argument 1 of ‘npy_intp PyArray_DIM(const PyArrayObject*, int)’
#5 27.77        1532 | PyArray_DIM(const PyArrayObject *arr, int idim)
#5 27.77             |             ~~~~~~~~~~~~~~~~~~~~~^~~
#5 27.77       cpp/mrptmodule.cpp:310:27: error: cannot convert ‘PyObject*’ {aka ‘_object*’} to ‘const PyArrayObject*’ {aka ‘const tagPyArrayObject_fields*’}
#5 27.77         310 |         dim = PyArray_DIM(v, 1);
#5 27.77             |                           ^
#5 27.77             |                           |
#5 27.77             |                           PyObject* {aka _object*}
#5 27.77       /app/.eggs/numpy-2.0.1-py3.9-linux-x86_64.egg/numpy/_core/include/numpy/ndarraytypes.h:1532:34: note:   initializing argument 1 of ‘npy_intp PyArray_DIM(const PyArrayObject*, int)’
#5 27.77        1532 | PyArray_DIM(const PyArrayObject *arr, int idim)
#5 27.77             |             ~~~~~~~~~~~~~~~~~~~~~^~~
#5 27.77       cpp/mrptmodule.cpp:314:61: error: cannot convert ‘PyObject*’ {aka ‘_object*’} to ‘const PyArrayObject*’ {aka ‘const tagPyArrayObject_fields*’}
#5 27.77         314 |         int *outdata = reinterpret_cast<int *>(PyArray_DATA(nearest));
#5 27.77             |                                                             ^~~~~~~
#5 27.77             |                                                             |
#5 27.77             |                                                             PyObject* {aka _object*}
#5 27.77       /app/.eggs/numpy-2.0.1-py3.9-linux-x86_64.egg/numpy/_core/include/numpy/ndarraytypes.h:1508:35: note:   initializing argument 1 of ‘void* PyArray_DATA(const PyArrayObject*)’
#5 27.77        1508 | PyArray_DATA(const PyArrayObject *arr)
#5 27.77             |              ~~~~~~~~~~~~~~~~~~~~~^~~
#5 27.77       cpp/mrptmodule.cpp:319:75: error: cannot convert ‘PyObject*’ {aka ‘_object*’} to ‘const PyArrayObject*’ {aka ‘const tagPyArrayObject_fields*’}
#5 27.77         319 |             float *distances_out = reinterpret_cast<float *>(PyArray_DATA(distances));
#5 27.77             |                                                                           ^~~~~~~~~
#5 27.77             |                                                                           |
#5 27.77             |                                                                           PyObject* {aka _object*}
#5 27.77       /app/.eggs/numpy-2.0.1-py3.9-linux-x86_64.egg/numpy/_core/include/numpy/ndarraytypes.h:1508:35: note:   initializing argument 1 of ‘void* PyArray_DATA(const PyArrayObject*)’
#5 27.77        1508 | PyArray_DATA(const PyArrayObject *arr)
#5 27.77             |              ~~~~~~~~~~~~~~~~~~~~~^~~
#5 27.77       cpp/mrptmodule.cpp: In function ‘PyObject* exact_search(mrptIndex*, PyObject*)’:
#5 27.77       cpp/mrptmodule.cpp:345:60: error: cannot convert ‘PyObject*’ {aka ‘_object*’} to ‘const PyArrayObject*’ {aka ‘const tagPyArrayObject_fields*’}
#5 27.77         345 |     float *indata = reinterpret_cast<float *>(PyArray_DATA(v));
#5 27.77             |                                                            ^
#5 27.77             |                                                            |
#5 27.77             |                                                            PyObject* {aka _object*}
#5 27.77       /app/.eggs/numpy-2.0.1-py3.9-linux-x86_64.egg/numpy/_core/include/numpy/ndarraytypes.h:1508:35: note:   initializing argument 1 of ‘void* PyArray_DATA(const PyArrayObject*)’
#5 27.77        1508 | PyArray_DATA(const PyArrayObject *arr)
#5 27.77             |              ~~~~~~~~~~~~~~~~~~~~~^~~
#5 27.77       cpp/mrptmodule.cpp:348:22: error: cannot convert ‘PyObject*’ {aka ‘_object*’} to ‘const PyArrayObject*’ {aka ‘const tagPyArrayObject_fields*’}
#5 27.77         348 |     if (PyArray_NDIM(v) == 1) {
#5 27.77             |                      ^
#5 27.77             |                      |
#5 27.77             |                      PyObject* {aka _object*}
#5 27.77       /app/.eggs/numpy-2.0.1-py3.9-linux-x86_64.egg/numpy/_core/include/numpy/ndarraytypes.h:1502:35: note:   initializing argument 1 of ‘int PyArray_NDIM(const PyArrayObject*)’
#5 27.77        1502 | PyArray_NDIM(const PyArrayObject *arr)
#5 27.77             |              ~~~~~~~~~~~~~~~~~~~~~^~~
#5 27.77       cpp/mrptmodule.cpp:349:27: error: cannot convert ‘PyObject*’ {aka ‘_object*’} to ‘const PyArrayObject*’ {aka ‘const tagPyArrayObject_fields*’}
#5 27.77         349 |         dim = PyArray_DIM(v, 0);
#5 27.77             |                           ^
#5 27.77             |                           |
#5 27.77             |                           PyObject* {aka _object*}
#5 27.77       /app/.eggs/numpy-2.0.1-py3.9-linux-x86_64.egg/numpy/_core/include/numpy/ndarraytypes.h:1532:34: note:   initializing argument 1 of ‘npy_intp PyArray_DIM(const PyArrayObject*, int)’
#5 27.77        1532 | PyArray_DIM(const PyArrayObject *arr, int idim)
#5 27.77             |             ~~~~~~~~~~~~~~~~~~~~~^~~
#5 27.77       cpp/mrptmodule.cpp:353:61: error: cannot convert ‘PyObject*’ {aka ‘_object*’} to ‘const PyArrayObject*’ {aka ‘const tagPyArrayObject_fields*’}
#5 27.77         353 |         int *outdata = reinterpret_cast<int *>(PyArray_DATA(nearest));
#5 27.77             |                                                             ^~~~~~~
#5 27.77             |                                                             |
#5 27.77             |                                                             PyObject* {aka _object*}
#5 27.77       /app/.eggs/numpy-2.0.1-py3.9-linux-x86_64.egg/numpy/_core/include/numpy/ndarraytypes.h:1508:35: note:   initializing argument 1 of ‘void* PyArray_DATA(const PyArrayObject*)’
#5 27.77        1508 | PyArray_DATA(const PyArrayObject *arr)
#5 27.77             |              ~~~~~~~~~~~~~~~~~~~~~^~~
#5 27.77       cpp/mrptmodule.cpp:357:75: error: cannot convert ‘PyObject*’ {aka ‘_object*’} to ‘const PyArrayObject*’ {aka ‘const tagPyArrayObject_fields*’}
#5 27.77         357 |             float *out_distances = reinterpret_cast<float *>(PyArray_DATA(distances));
#5 27.77             |                                                                           ^~~~~~~~~
#5 27.77             |                                                                           |
#5 27.77             |                                                                           PyObject* {aka _object*}
#5 27.77       /app/.eggs/numpy-2.0.1-py3.9-linux-x86_64.egg/numpy/_core/include/numpy/ndarraytypes.h:1508:35: note:   initializing argument 1 of ‘void* PyArray_DATA(const PyArrayObject*)’
#5 27.77        1508 | PyArray_DATA(const PyArrayObject *arr)
#5 27.77             |              ~~~~~~~~~~~~~~~~~~~~~^~~
#5 27.77       cpp/mrptmodule.cpp:369:25: error: cannot convert ‘PyObject*’ {aka ‘_object*’} to ‘const PyArrayObject*’ {aka ‘const tagPyArrayObject_fields*’}
#5 27.77         369 |         n = PyArray_DIM(v, 0);
#5 27.77             |                         ^
#5 27.77             |                         |
#5 27.77             |                         PyObject* {aka _object*}
#5 27.77       /app/.eggs/numpy-2.0.1-py3.9-linux-x86_64.egg/numpy/_core/include/numpy/ndarraytypes.h:1532:34: note:   initializing argument 1 of ‘npy_intp PyArray_DIM(const PyArrayObject*, int)’
#5 27.77        1532 | PyArray_DIM(const PyArrayObject *arr, int idim)
#5 27.77             |             ~~~~~~~~~~~~~~~~~~~~~^~~
#5 27.77       cpp/mrptmodule.cpp:370:27: error: cannot convert ‘PyObject*’ {aka ‘_object*’} to ‘const PyArrayObject*’ {aka ‘const tagPyArrayObject_fields*’}
#5 27.77         370 |         dim = PyArray_DIM(v, 1);
#5 27.77             |                           ^
#5 27.77             |                           |
#5 27.77             |                           PyObject* {aka _object*}
#5 27.77       /app/.eggs/numpy-2.0.1-py3.9-linux-x86_64.egg/numpy/_core/include/numpy/ndarraytypes.h:1532:34: note:   initializing argument 1 of ‘npy_intp PyArray_DIM(const PyArrayObject*, int)’
#5 27.77        1532 | PyArray_DIM(const PyArrayObject *arr, int idim)
#5 27.77             |             ~~~~~~~~~~~~~~~~~~~~~^~~
#5 27.77       cpp/mrptmodule.cpp:374:61: error: cannot convert ‘PyObject*’ {aka ‘_object*’} to ‘const PyArrayObject*’ {aka ‘const tagPyArrayObject_fields*’}
#5 27.77         374 |         int *outdata = reinterpret_cast<int *>(PyArray_DATA(nearest));
#5 27.77             |                                                             ^~~~~~~
#5 27.77             |                                                             |
#5 27.77             |                                                             PyObject* {aka _object*}
#5 27.77       /app/.eggs/numpy-2.0.1-py3.9-linux-x86_64.egg/numpy/_core/include/numpy/ndarraytypes.h:1508:35: note:   initializing argument 1 of ‘void* PyArray_DATA(const PyArrayObject*)’
#5 27.77        1508 | PyArray_DATA(const PyArrayObject *arr)
#5 27.77             |              ~~~~~~~~~~~~~~~~~~~~~^~~
#5 27.77       cpp/mrptmodule.cpp:379:75: error: cannot convert ‘PyObject*’ {aka ‘_object*’} to ‘const PyArrayObject*’ {aka ‘const tagPyArrayObject_fields*’}
#5 27.77         379 |             float *distances_out = reinterpret_cast<float *>(PyArray_DATA(distances));
#5 27.77             |                                                                           ^~~~~~~~~
#5 27.77             |                                                                           |
#5 27.77             |                                                                           PyObject* {aka _object*}
#5 27.77       /app/.eggs/numpy-2.0.1-py3.9-linux-x86_64.egg/numpy/_core/include/numpy/ndarraytypes.h:1508:35: note:   initializing argument 1 of ‘void* PyArray_DATA(const PyArrayObject*)’
#5 27.77        1508 | PyArray_DATA(const PyArrayObject *arr)
#5 27.77             |              ~~~~~~~~~~~~~~~~~~~~~^~~
#5 27.77       cpp/mrptmodule.cpp:395:1: warning: control reaches end of non-void function [-Wreturn-type]
#5 27.77         395 | }
#5 27.77             | ^
#5 27.77       cpp/mrptmodule.cpp: In function ‘PyObject* ann(mrptIndex*, PyObject*)’:
#5 27.77       cpp/mrptmodule.cpp:336:1: warning: control reaches end of non-void function [-Wreturn-type]
#5 27.77         336 | }
#5 27.77             | ^
#5 27.77       error: command '/usr/bin/gcc' failed with exit code 1
#5 27.77       [end of output]
#5 27.77   
#5 27.77   note: This error originates from a subprocess, and is likely not a problem with pip.
#5 27.77   ERROR: Failed building wheel for mrpt
#5 27.77   Running setup.py clean for mrpt
#5 27.86 Failed to build mrpt
#5 27.86 ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (mrpt)
------
process "/bin/sh -c pip install ." did not complete successfully: exit code: 1