Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python_wrap test TestInvertedMultiIndexBuilder not working #1

Open
heinrichI opened this issue Oct 10, 2020 · 13 comments
Open

python_wrap test TestInvertedMultiIndexBuilder not working #1

heinrichI opened this issue Oct 10, 2020 · 13 comments

Comments

@heinrichI
Copy link

heinrichI commented Oct 10, 2020

I change

vectors_arr = np.array([
            [0, 0, 0, 0, 0, 0],
            [0, 0, 0, 1, 2, 3],
            [1, 2, 3, 0, 0, 0],
            [1, 2, 3, 1, 2, 3]
        ], dtype=np.float32
        ) 

to

vectors_arr = np.array([
            [0, 0, 0, 0, 0, 0],
            [0, 0, 0, 1, 2, 3],
            [1, 2, 3, 0, 0, 0],
            [1, 2, 3, 1, 2, 3]
        ], dtype=np.int
        ) 

in test-InvertedMultiIndexBuilder.py
Otherwise, the function buildInvertedMultiIndex was not started with ValueError: Buffer dtype mismatch.
And also add

  extra_compile_args=["-Zi", "/Od"],
  extra_link_args=["-debug"],

in setup.py for debuging C.
Now function

pyimi.PyInvertedMultiIndexBuilder().buildInvertedMultiIndex(vector_ids, vectors_arr,
                                                                              subspaced_centrois)

started, but:

image

image

@DIMAthe47
Copy link
Owner

DIMAthe47 commented Oct 10, 2020

I had to change dtypes too because of ValueError: Buffer dtype mismatch.
And then test runs, but fails with test assertions because of wrong results (maybe examples are outdated, I will check).
But it runs and this line doesn't fail:

py_imi = pyimi.PyInvertedMultiIndexBuilder().buildInvertedMultiIndex(vector_ids, vectors_arr,
                                                                               subspaced_centrois)

Maybe try to remove 3.6, 3.7 library versions and run with python 3.5.
I advise to check with DependenciesGui.exe (run from venv) that it finds correct libraries.

@heinrichI
Copy link
Author

After much agony with python 3.5 and mingw:

c:\Python35\python.exe setup.py build_ext -i -f && ^
Продолжить? y
options (after parsing config files):
options (after parsing command line):
option dict for 'build' command:
  {'compiler': ('c:\\Python35\\lib\\distutils\\distutils.cfg', 'mingw32')}
option dict for 'build_ext' command:
  {'force': ('command line', 1), 'inplace': ('command line', 1)}
running build_ext
Distribution.get_command_obj(): creating 'build_ext' command object
  setting options for 'build_ext' command:
    inplace = 1 (from command line)
    force = 1 (from command line)
Distribution.get_command_obj(): creating 'build' command object
  setting options for 'build' command:
    compiler = mingw32 (from c:\Python35\lib\distutils\distutils.cfg)
Python's GCC status: ok (details: 'c:\Python35\include\pyconfig.h' mentions '__G
NUC__')
executable: gcc
Call Popen
executable: ld
Call Popen
executable: dllwrap
Call Popen
mingw32: gcc 6.1.0, ld 2.25, dllwrap 2.25

Distribution.get_command_obj(): creating 'build_py' command object
building 'py_inverted_multi_index' extension
c:\mingw64\bin\gcc.exe -mdll -O -Wall -Ie:\SourcePython\inverted_multi_index\src
 -Ie:\SourcePython\inverted_multi_index\OpenBLAS-v0.2.19-Win64-int32\include -Ic
:\Python35\lib\site-packages\numpy\core\include -Ic:\Python35\include -Ic:\Pytho
n35\include -c py_inverted_multi_index.cpp -o build\temp.win-amd64-3.5\Release\p
y_inverted_multi_index.o
In file included from c:/mingw64/lib/gcc/x86_64-w64-mingw32/6.1.0/include/c++/ma
th.h:36:0,
                 from c:\Python35\include/pyport.h:328,
                 from c:\Python35\include/Python.h:50,
                 from py_inverted_multi_index.cpp:46:
c:/mingw64/lib/gcc/x86_64-w64-mingw32/6.1.0/include/c++/cmath:1133:11: error: ':
:hypot' has not been declared
   using ::hypot;
           ^~~~~
py_inverted_multi_index.cpp:243:41: warning: division by zero [-Wdiv-by-zero]
     enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*))
 };
                                       ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

py_inverted_multi_index.cpp:243:79: error: division by zero is not a constant-ex
pression
     enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*))
 };
                                                                               ^

py_inverted_multi_index.cpp:243:41: error: '(1 / 0)' is not a constant expressio
n
     enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*))
 };
                                       ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

py_inverted_multi_index.cpp:243:79: error: enumerator value for '__pyx_check_siz
eof_voidp' is not an integer constant
     enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*))
 };
                                                                               ^

In file included from c:\Python35\lib\site-packages\numpy\core\include/numpy/nda
rraytypes.h:1832:0,
                 from c:\Python35\lib\site-packages\numpy\core\include/numpy/nda
rrayobject.h:12,
                 from c:\Python35\lib\site-packages\numpy\core\include/numpy/arr
ayobject.h:4,
                 from py_inverted_multi_index.cpp:673:
c:\Python35\lib\site-packages\numpy\core\include/numpy/npy_1_7_deprecated_api.h:
15:77: note: #pragma message: c:\Python35\lib\site-packages\numpy\core\include/n
umpy/npy_1_7_deprecated_api.h(14) : Warning Msg: Using deprecated NumPy API, dis
able it with #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
                          "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION")
                                                                             ^
py_inverted_multi_index.cpp: In function 'void* __pyx_align_pointer(void*, size_
t)':
py_inverted_multi_index.cpp:10657:37: error: cast from 'void*' to 'Py_intptr_t {
aka int}' loses precision [-fpermissive]
   __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory);
                                     ^~~~~~~~~~~~~~
py_inverted_multi_index.cpp:10703:22: warning: cast to pointer from integer of d
ifferent size [-Wint-to-pointer-cast]
   __pyx_r = ((void *)__pyx_v_aligned_p);
                      ^~~~~~~~~~~~~~~~~
py_inverted_multi_index.cpp: In function 'PyTypeObject* __Pyx_ImportType(PyObjec
t*, const char*, const char*, size_t, __Pyx_ImportType_CheckSize)':
py_inverted_multi_index.cpp:26182:53: warning: unknown conversion type character
 'z' in format [-Wformat=]
             module_name, class_name, size, basicsize);
                                                     ^
py_inverted_multi_index.cpp:26182:53: warning: unknown conversion type character
 'z' in format [-Wformat=]
py_inverted_multi_index.cpp:26182:53: warning: too many arguments for format [-W
format-extra-args]
In file included from py_inverted_multi_index.cpp:668:0:
e:\SourcePython\inverted_multi_index\src/multiindex/InvertedMultiIndexBuilder.h:
 In instantiation of 'InvertedMultiIndex<IndexEntry>* InvertedMultiIndexBuilder<
IndexEntry>::buildInvertedMultiIndex(IndexEntry*, int, int*, int, int) [with Ind
exEntry = int]':
py_inverted_multi_index.cpp:3403:366:   required from here
e:\SourcePython\inverted_multi_index\src/multiindex/InvertedMultiIndexBuilder.h:
39:13: warning: unused variable 'm' [-Wunused-variable]
         int m = subspaces_count;
             ^
In file included from py_inverted_multi_index.cpp:664:0:
e:\SourcePython\inverted_multi_index\src/util/array_utils.h: In instantiation of
 'void c_delete(const T*) [with T = void]':
py_inverted_multi_index.cpp:4715:31:   required from here
e:\SourcePython\inverted_multi_index\src/util/array_utils.h:116:5: warning: dele
ting 'const void*' is undefined [-Wdelete-incomplete]
     delete[] c_arr;
     ^~~~~~
In file included from e:\SourcePython\inverted_multi_index\src/multiindex/Invert
edMultiIndexSearcher.h:9:0,
                 from py_inverted_multi_index.cpp:669:
e:\SourcePython\inverted_multi_index\src/multiindex/MultiSequenceAlgorithm.h: In
 instantiation of 'void MultiSequenceAlgorithm<T>::find_and_write_candidates(con
st float*, const int*, T*, int) [with T = int]':
e:\SourcePython\inverted_multi_index\src/multiindex/InvertedMultiIndexSearcher.h
:68:9:   required from 'void InvertedMultiIndexSearcher<IndexEntry, FLOAT>::find
Nearest(const FLOAT*, IndexEntry*, int) [with IndexEntry = int; FLOAT = float]'
py_inverted_multi_index.cpp:4530:457:   required from here
e:\SourcePython\inverted_multi_index\src/multiindex/MultiSequenceAlgorithm.h:151
:15: warning: unused variable 'PREV_PRIORITY' [-Wunused-variable]
         float PREV_PRIORITY = start_element.priority;
               ^~~~~~~~~~~~~
Traceback (most recent call last):
  File "c:\Python35\lib\distutils\cygwinccompiler.py", line 180, in _compile
    extra_postargs)
  File "c:\Python35\lib\distutils\ccompiler.py", line 909, in spawn
    spawn(cmd, dry_run=self.dry_run)
  File "c:\Python35\lib\distutils\spawn.py", line 38, in spawn
    _spawn_nt(cmd, search_path, dry_run=dry_run)
  File "c:\Python35\lib\distutils\spawn.py", line 81, in _spawn_nt
    "command %r failed with exit status %d" % (cmd, rc))
distutils.errors.DistutilsExecError: command ['gcc', '-mdll', '-O', '-Wall', '-I
e:\\SourcePython\\inverted_multi_index\\src', '-Ie:\\SourcePython\\inverted_mult
i_index\\OpenBLAS-v0.2.19-Win64-int32\\include', '-Ic:\\Python35\\lib\\site-pack
ages\\numpy\\core\\include', '-Ic:\\Python35\\include', '-Ic:\\Python35\\include
', '-c', 'py_inverted_multi_index.cpp', '-o', 'build\\temp.win-amd64-3.5\\Releas
e\\py_inverted_multi_index.o'] failed with exit status 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "setup.py", line 24, in <module>
    ext_modules=cythonize(extensions),
  File "c:\Python35\lib\distutils\core.py", line 148, in setup
    dist.run_commands()
  File "c:\Python35\lib\distutils\dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "c:\Python35\lib\distutils\dist.py", line 974, in run_command
    cmd_obj.run()
  File "c:\Python35\lib\distutils\command\build_ext.py", line 339, in run
    self.build_extensions()
  File "c:\Python35\lib\distutils\command\build_ext.py", line 448, in build_exte
nsions
    self._build_extensions_serial()
  File "c:\Python35\lib\distutils\command\build_ext.py", line 473, in _build_ext
ensions_serial
    self.build_extension(ext)
  File "c:\Python35\lib\distutils\command\build_ext.py", line 533, in build_exte
nsion
    depends=ext.depends)
  File "c:\Python35\lib\distutils\ccompiler.py", line 574, in compile
    self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
  File "c:\Python35\lib\distutils\cygwinccompiler.py", line 182, in _compile
    raise CompileError(msg)
distutils.errors.CompileError: command ['gcc', '-mdll', '-O', '-Wall', '-Ie:\\So
urcePython\\inverted_multi_index\\src', '-Ie:\\SourcePython\\inverted_multi_inde
x\\OpenBLAS-v0.2.19-Win64-int32\\include', '-Ic:\\Python35\\lib\\site-packages\\
numpy\\core\\include', '-Ic:\\Python35\\include', '-Ic:\\Python35\\include', '-c
', 'py_inverted_multi_index.cpp', '-o', 'build\\temp.win-amd64-3.5\\Release\\py_
inverted_multi_index.o'] failed with exit status 1

@heinrichI
Copy link
Author

Finally I compile with mingw and error still same, on row:

py_imi = pyimi.PyInvertedMultiIndexBuilder().buildInvertedMultiIndex(vector_ids, vectors_arr,
                                                                subspaced_centrois)

test stop with error:
image
Same on python 3.5:
image
Attach my librarys.
inverted_multi_index.zip

@DIMAthe47
Copy link
Owner

I have just rebuilt py_inverted_multi_index from scratch today(I have reinstalled windows 7 recently).

https://stackoverflow.com/questions/2817869/error-unable-to-find-vcvarsall-bat
From comments:

You should not under any circumstances compile Python C extension using different (version of) compiler that the one used to compile Python itself as those two (versions of) compilers will probably have incompatible C runtime libraries.

My steps.
When I run Python I have:
Python 3.5.4 (v3.5.4:3f56838, Aug 8 2017, 02:17:05) [MSC v.1900 64 bit (AMD64)] on win32
It means I need to build extensions with MSC v.1900. It is Visual Studio 14.0 2015.
So I installed it.

I have in path:
OpenBLAS-v0.2.19-Win64-int32\bin (It has libopenblas.dll)
x86_64-6.1.0-release-win32-seh-rt_v5-rev1\mingw64\bin (It has libgfortran-3.dll)

To build extension:
Run this bat file in terminal(cmd) to "init environment" - it will modify PATH and set some variables.
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat

Then I need to force usage of 64 bit compiler (https://stackoverflow.com/a/5171276):

set DISTUTILS_USE_SDK=1
set MSSdk=1

Then run

python -m setup.py build_ext -i

It gave me:

LINK : fatal error LNK1181: cannot open input file 'libopenblas.lib'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\amd64\\link.exe' failed with exit status 1181

That is because linker was searching for libopenblas.lib but openblas is shipped with libopenblas.dll.a import library.
I just renamed it to libopenblas.lib and then rerun:

python -m setup.py build_ext -i

Extension has built.
Then I run test-InvertedMultiIndexBuilder.py and it fails with wrong assert of results (but no crashes).

My current setup.py (slightly modified):

SRC_DIR = r'C:\Users\Dima\ClionProjects\inverted_multi_index\src'
OPENBLAS_INCLUDE_DIR = r'C:\openblas\OpenBLAS-v0.2.19-Win64-int32\include'
OPENBLAS_LIB_DIR = r'C:\openblas\OpenBLAS-v0.2.19-Win64-int32\lib'

extensions = [
    Extension("py_inverted_multi_index", ["py_inverted_multi_index.pyx"],
              include_dirs=[SRC_DIR, OPENBLAS_INCLUDE_DIR, get_include()],
              libraries=[r'libopenblas'],
              library_dirs=[OPENBLAS_LIB_DIR]
              ),
    Extension("py_multi_index_util", ["py_multi_index_util.pyx"],
              include_dirs=[SRC_DIR, get_include()]
              )
]

setup(
    name="build_inverted_multi_index",
    ext_modules=cythonize(extensions),
)

@heinrichI
Copy link
Author

My python:
image
This is MSVC++ 14.14 _MSC_VER == 1914 (Visual Studio 2017 version 15.7)
Install it, compile. And still same crash.

e:\SourcePython\inverted_multi_index\python_wrap\inverted_multi_index>python set
up.py build_ext -i -f && ^
Продолжить? y
running build_ext
building 'py_inverted_multi_index' extension
self.cc C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\M
SVC\14.16.27023\bin\HostX64\x64\cl.exe
['C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\
MSVC\\14.16.27023\\bin\\HostX64\\x64\\cl.exe', '/c', '/nologo', '/Ox', '/W3', '/
GL', '/DNDEBUG', '/MT', '-Ie:\\SourcePython\\inverted_multi_index\\src', '-Ie:\\
SourcePython\\inverted_multi_index\\OpenBLAS-v0.2.19-Win64-int32\\include', '-IC
:\\Python37\\lib\\site-packages\\numpy\\core\\include', '-IC:\\Python37\\include
', '-IC:\\Python37\\include', '-IC:\\Program Files (x86)\\Microsoft Visual Studi
o\\2017\\Community\\VC\\Tools\\MSVC\\14.16.27023\\include', '-IC:\\Program Files
 (x86)\\Windows Kits\\NETFXSDK\\4.6.1\\include\\um', '-IC:\\Program Files (x86)\
\Windows Kits\\10\\include\\10.0.17763.0\\ucrt', '-IC:\\Program Files (x86)\\Win
dows Kits\\10\\include\\10.0.17763.0\\shared', '-IC:\\Program Files (x86)\\Windo
ws Kits\\10\\include\\10.0.17763.0\\um', '-IC:\\Program Files (x86)\\Windows Kit
s\\10\\include\\10.0.17763.0\\winrt', '-IC:\\Program Files (x86)\\Windows Kits\\
10\\include\\10.0.17763.0\\cppwinrt', '/EHsc', '/Tppy_inverted_multi_index.cpp',
 '/Fobuild\\temp.win-amd64-3.7\\Release\\py_inverted_multi_index.obj', '-Zi', '/
Od']
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.1
6.27023\bin\HostX64\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -Ie:\SourcePy
thon\inverted_multi_index\src -Ie:\SourcePython\inverted_multi_index\OpenBLAS-v0
.2.19-Win64-int32\include -IC:\Python37\lib\site-packages\numpy\core\include -IC
:\Python37\include -IC:\Python37\include "-IC:\Program Files (x86)\Microsoft Vis
ual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files
 (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows
 Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\in
clude\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.
0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\win
rt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /EH
sc /Tppy_inverted_multi_index.cpp /Fobuild\temp.win-amd64-3.7\Release\py_inverte
d_multi_index.obj -Zi /Od
cl : Command line warning D9025 : overriding '/Ox' with '/Od'
py_inverted_multi_index.cpp
c:\python37\lib\site-packages\numpy\core\include\numpy\npy_1_7_deprecated_api.h(
14) : Warning Msg: Using deprecated NumPy API, disable it with #define NPY_NO_DE
PRECATED_API NPY_1_7_API_VERSION
py_inverted_multi_index.cpp(3308): warning C4267: '=': conversion from 'size_t'
to 'int', possible loss of data
py_inverted_multi_index.cpp(3341): warning C4244: '=': conversion from 'Py_ssize
_t' to 'int', possible loss of data
py_inverted_multi_index.cpp(3350): warning C4244: '=': conversion from 'Py_ssize
_t' to 'int', possible loss of data
py_inverted_multi_index.cpp(5224): warning C4244: '=': conversion from 'npy_intp
' to 'int', possible loss of data
py_inverted_multi_index.cpp(5332): warning C4244: '=': conversion from 'Py_ssize
_t' to 'int', possible loss of data
py_inverted_multi_index.cpp(5341): warning C4244: '=': conversion from 'Py_ssize
_t' to 'int', possible loss of data
py_inverted_multi_index.cpp(5425): warning C4244: '=': conversion from 'Py_ssize
_t' to 'int', possible loss of data
py_inverted_multi_index.cpp(5434): warning C4244: '=': conversion from 'Py_ssize
_t' to 'int', possible loss of data
py_inverted_multi_index.cpp(5443): warning C4244: '=': conversion from 'Py_ssize
_t' to 'int', possible loss of data
e:\sourcepython\inverted_multi_index\src\multiindex\MultiSequenceAlgorithm.h(168
): warning C4244: 'initializing': conversion from 'T' to 'int', possible loss of
 data
        with
        [
            T=__int64
        ]
e:\sourcepython\inverted_multi_index\src\multiindex\MultiSequenceAlgorithm.h(113
): note: while compiling class template member function 'void MultiSequenceAlgor
ithm<IndexEntry>::find_and_write_candidates(const float *,const int *,T *,const
int)'
        with
        [
            IndexEntry=__pyx_t_30py_inverted_multi_index_common_IndexEntry,
            T=__pyx_t_30py_inverted_multi_index_common_IndexEntry
        ]
e:\SourcePython\inverted_multi_index\src\multiindex/InvertedMultiIndexSearcher.h
(68): note: see reference to function template instantiation 'void MultiSequence
Algorithm<IndexEntry>::find_and_write_candidates(const float *,const int *,T *,c
onst int)' being compiled
        with
        [
            IndexEntry=__pyx_t_30py_inverted_multi_index_common_IndexEntry,
            T=__pyx_t_30py_inverted_multi_index_common_IndexEntry
        ]
e:\SourcePython\inverted_multi_index\src\multiindex/InvertedMultiIndexSearcher.h
(17): note: see reference to class template instantiation 'MultiSequenceAlgorith
m<IndexEntry>' being compiled
        with
        [
            IndexEntry=__pyx_t_30py_inverted_multi_index_common_IndexEntry
        ]
py_inverted_multi_index.cpp(4267): note: see reference to class template instant
iation 'InvertedMultiIndexSearcher<__pyx_t_30py_inverted_multi_index_common_Inde
xEntry,__pyx_t_30py_inverted_multi_index_common_FLOAT>' being compiled
e:\sourcepython\inverted_multi_index\src\multiindex\MultiSequenceAlgorithm.h(176
): warning C4244: 'initializing': conversion from 'T' to 'int', possible loss of
 data
        with
        [
            T=__int64
        ]
e:\sourcepython\inverted_multi_index\src\multiindex\MultiSequenceAlgorithm.h(71)
: warning C4244: 'initializing': conversion from 'T' to 'int', possible loss of
data
        with
        [
            T=__int64
        ]
e:\sourcepython\inverted_multi_index\src\multiindex\MultiSequenceAlgorithm.h(65)
: note: while compiling class template member function 'bool MultiSequenceAlgori
thm<IndexEntry>::check_surrounding_cells_visited(const int *,bool *)'
        with
        [
            IndexEntry=__pyx_t_30py_inverted_multi_index_common_IndexEntry
        ]
e:\sourcepython\inverted_multi_index\src\multiindex\MultiSequenceAlgorithm.h(94)
: note: see reference to function template instantiation 'bool MultiSequenceAlgo
rithm<IndexEntry>::check_surrounding_cells_visited(const int *,bool *)' being co
mpiled
        with
        [
            IndexEntry=__pyx_t_30py_inverted_multi_index_common_IndexEntry
        ]
e:\sourcepython\inverted_multi_index\src\multiindex\MultiSequenceAlgorithm.h(72)
: warning C4244: 'initializing': conversion from 'T' to 'int', possible loss of
data
        with
        [
            T=__int64
        ]
e:\sourcepython\inverted_multi_index\src\multiindex\MultiSequenceAlgorithm.h(60)
: warning C4244: 'initializing': conversion from 'T' to 'int', possible loss of
data
        with
        [
            T=__int64
        ]
e:\sourcepython\inverted_multi_index\src\multiindex\MultiSequenceAlgorithm.h(59)
: note: while compiling class template member function 'bool MultiSequenceAlgori
thm<IndexEntry>::check_cell_already_visited(const int *,bool *)'
        with
        [
            IndexEntry=__pyx_t_30py_inverted_multi_index_common_IndexEntry
        ]
e:\sourcepython\inverted_multi_index\src\multiindex\MultiSequenceAlgorithm.h(91)
: note: see reference to function template instantiation 'bool MultiSequenceAlgo
rithm<IndexEntry>::check_cell_already_visited(const int *,bool *)' being compile
d
        with
        [
            IndexEntry=__pyx_t_30py_inverted_multi_index_common_IndexEntry
        ]
['C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\
MSVC\\14.16.27023\\bin\\HostX64\\x64\\link.exe', '/nologo', '/INCREMENTAL:NO', '
/LTCG', '/nodefaultlib:libucrt.lib', 'ucrt.lib', '/DLL', '/MANIFEST:EMBED,ID=2',
 '/MANIFESTUAC:NO', '/LIBPATH:e:\\SourcePython\\inverted_multi_index\\OpenBLAS-v
0.2.19-Win64-int32\\lib', '/LIBPATH:C:\\Python37\\libs', '/LIBPATH:C:\\Python37\
\PCbuild\\amd64', '/LIBPATH:C:\\Program Files (x86)\\Microsoft Visual Studio\\20
17\\Community\\VC\\Tools\\MSVC\\14.16.27023\\lib\\x64', '/LIBPATH:C:\\Program Fi
les (x86)\\Windows Kits\\NETFXSDK\\4.6.1\\lib\\um\\x64', '/LIBPATH:C:\\Program F
iles (x86)\\Windows Kits\\10\\lib\\10.0.17763.0\\ucrt\\x64', '/LIBPATH:C:\\Progr
am Files (x86)\\Windows Kits\\10\\lib\\10.0.17763.0\\um\\x64', 'libopenblas.dll.
lib', '/EXPORT:PyInit_py_inverted_multi_index', 'build\\temp.win-amd64-3.7\\Rele
ase\\py_inverted_multi_index.obj', '/OUT:e:\\SourcePython\\inverted_multi_index\
\python_wrap\\inverted_multi_index\\py_inverted_multi_index.cp37-win_amd64.pyd',
 '/IMPLIB:build\\temp.win-amd64-3.7\\Release\\py_inverted_multi_index.cp37-win_a
md64.lib', '-debug']
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.1
6.27023\bin\HostX64\x64\link.exe /nologo /INCREMENTAL:NO /LTCG /nodefaultlib:lib
ucrt.lib ucrt.lib /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:e:\SourcePy
thon\inverted_multi_index\OpenBLAS-v0.2.19-Win64-int32\lib /LIBPATH:C:\Python37\
libs /LIBPATH:C:\Python37\PCbuild\amd64 "/LIBPATH:C:\Program Files (x86)\Microso
ft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\lib\x64" "/LIBPATH:C:\
Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64" "/LIBPATH:C:\Program
 Files (x86)\Windows Kits\10\lib\10.0.17763.0\ucrt\x64" "/LIBPATH:C:\Program Fil
es (x86)\Windows Kits\10\lib\10.0.17763.0\um\x64" libopenblas.dll.lib /EXPORT:Py
Init_py_inverted_multi_index build\temp.win-amd64-3.7\Release\py_inverted_multi_
index.obj /OUT:e:\SourcePython\inverted_multi_index\python_wrap\inverted_multi_i
ndex\py_inverted_multi_index.cp37-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.7
\Release\py_inverted_multi_index.cp37-win_amd64.lib -debug
   Creating library build\temp.win-amd64-3.7\Release\py_inverted_multi_index.cp3
7-win_amd64.lib and object build\temp.win-amd64-3.7\Release\py_inverted_multi_in
dex.cp37-win_amd64.exp
Generating code
Finished generating code
building 'py_multi_index_util' extension
['C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\
MSVC\\14.16.27023\\bin\\HostX64\\x64\\cl.exe', '/c', '/nologo', '/Ox', '/W3', '/
GL', '/DNDEBUG', '/MT', '-Ie:\\SourcePython\\inverted_multi_index\\src', '-IC:\\
Python37\\lib\\site-packages\\numpy\\core\\include', '-IC:\\Python37\\include',
'-IC:\\Python37\\include', '-IC:\\Program Files (x86)\\Microsoft Visual Studio\\
2017\\Community\\VC\\Tools\\MSVC\\14.16.27023\\include', '-IC:\\Program Files (x
86)\\Windows Kits\\NETFXSDK\\4.6.1\\include\\um', '-IC:\\Program Files (x86)\\Wi
ndows Kits\\10\\include\\10.0.17763.0\\ucrt', '-IC:\\Program Files (x86)\\Window
s Kits\\10\\include\\10.0.17763.0\\shared', '-IC:\\Program Files (x86)\\Windows
Kits\\10\\include\\10.0.17763.0\\um', '-IC:\\Program Files (x86)\\Windows Kits\\
10\\include\\10.0.17763.0\\winrt', '-IC:\\Program Files (x86)\\Windows Kits\\10\
\include\\10.0.17763.0\\cppwinrt', '/EHsc', '/Tppy_multi_index_util.cpp', '/Fobu
ild\\temp.win-amd64-3.7\\Release\\py_multi_index_util.obj', '-Zi', '/Od']
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.1
6.27023\bin\HostX64\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -Ie:\SourcePy
thon\inverted_multi_index\src -IC:\Python37\lib\site-packages\numpy\core\include
 -IC:\Python37\include -IC:\Python37\include "-IC:\Program Files (x86)\Microsoft
 Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program F
iles (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Win
dows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\1
0\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include
\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0
\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt"
 /EHsc /Tppy_multi_index_util.cpp /Fobuild\temp.win-amd64-3.7\Release\py_multi_i
ndex_util.obj -Zi /Od
cl : Command line warning D9025 : overriding '/Ox' with '/Od'
py_multi_index_util.cpp
c:\python37\lib\site-packages\numpy\core\include\numpy\npy_1_7_deprecated_api.h(
14) : Warning Msg: Using deprecated NumPy API, disable it with #define NPY_NO_DE
PRECATED_API NPY_1_7_API_VERSION
py_multi_index_util.cpp(2891): warning C4244: '=': conversion from 'npy_intp' to
 'int', possible loss of data
['C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\
MSVC\\14.16.27023\\bin\\HostX64\\x64\\link.exe', '/nologo', '/INCREMENTAL:NO', '
/LTCG', '/nodefaultlib:libucrt.lib', 'ucrt.lib', '/DLL', '/MANIFEST:EMBED,ID=2',
 '/MANIFESTUAC:NO', '/LIBPATH:C:\\Python37\\libs', '/LIBPATH:C:\\Python37\\PCbui
ld\\amd64', '/LIBPATH:C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Co
mmunity\\VC\\Tools\\MSVC\\14.16.27023\\lib\\x64', '/LIBPATH:C:\\Program Files (x
86)\\Windows Kits\\NETFXSDK\\4.6.1\\lib\\um\\x64', '/LIBPATH:C:\\Program Files (
x86)\\Windows Kits\\10\\lib\\10.0.17763.0\\ucrt\\x64', '/LIBPATH:C:\\Program Fil
es (x86)\\Windows Kits\\10\\lib\\10.0.17763.0\\um\\x64', '/EXPORT:PyInit_py_mult
i_index_util', 'build\\temp.win-amd64-3.7\\Release\\py_multi_index_util.obj', '/
OUT:e:\\SourcePython\\inverted_multi_index\\python_wrap\\inverted_multi_index\\p
y_multi_index_util.cp37-win_amd64.pyd', '/IMPLIB:build\\temp.win-amd64-3.7\\Rele
ase\\py_multi_index_util.cp37-win_amd64.lib', '-debug']
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.1
6.27023\bin\HostX64\x64\link.exe /nologo /INCREMENTAL:NO /LTCG /nodefaultlib:lib
ucrt.lib ucrt.lib /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\Python37
\libs /LIBPATH:C:\Python37\PCbuild\amd64 "/LIBPATH:C:\Program Files (x86)\Micros
oft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\lib\x64" "/LIBPATH:C:
\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64" "/LIBPATH:C:\Progra
m Files (x86)\Windows Kits\10\lib\10.0.17763.0\ucrt\x64" "/LIBPATH:C:\Program Fi
les (x86)\Windows Kits\10\lib\10.0.17763.0\um\x64" /EXPORT:PyInit_py_multi_index
_util build\temp.win-amd64-3.7\Release\py_multi_index_util.obj /OUT:e:\SourcePyt
hon\inverted_multi_index\python_wrap\inverted_multi_index\py_multi_index_util.cp
37-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.7\Release\py_multi_index_util.cp
37-win_amd64.lib -debug
   Creating library build\temp.win-amd64-3.7\Release\py_multi_index_util.cp37-wi
n_amd64.lib and object build\temp.win-amd64-3.7\Release\py_multi_index_util.cp37
-win_amd64.exp
Generating code
Finished generating code

inverted_multi_index.zip

@heinrichI
Copy link
Author

Can you simply upload all .pxd?

@heinrichI
Copy link
Author

I think problem in:

cdef class _finalizer:
    def __dealloc__(self):
        cimi.c_delete(self._data)

cdef void set_base(cnp.ndarray arr, const void* c_arr):
    cdef _finalizer f=_finalizer()
    f._data=<const void*>c_arr
    cnp.set_array_base(arr, f)

After calling set_array_base not work any code.
Which version of numpy are you using?

@DIMAthe47
Copy link
Owner

Can you simply upload all .pxd?

You mean .pyd?

My installed packages:
Cython==0.29.21
numpy==1.18.5

@heinrichI
Copy link
Author

You mean .pyd?

Yes, .pyd files.

@DIMAthe47
Copy link
Owner

DIMAthe47 commented Nov 8, 2020

I have tried to build extensions with python 3.7 (Python 3.7.7 (tags/v3.7.7:d7c567b08f, Mar 10 2020, 10:41:24) [MSC v.1900 64 bit (AMD64)] on win32).
And eventually I got your error (Access violation reading location).
I dont know how to fix it.

@DIMAthe47
Copy link
Owner

Here are .pyd files built with python 3.5 (that do not crash).
build35.zip

@heinrichI
Copy link
Author

Which version of python are you use? python-3.5.4-amd64?
I got another error with you files:
image

@DIMAthe47
Copy link
Owner

Python 3.5.4 (v3.5.4:3f56838, Aug 8 2017, 02:17:05) [MSC v.1900 64 bit (AMD64)]

And I have to specify np.int32 types for these arrays:

vector_ids = np.array(..., dtype=np.int32)
vectors_arr = np.array(..., dtype=np.int32)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants