bittremieux / ANN-SoLo

Spectral library searching using approximate nearest neighbor techniques.
Apache License 2.0
42 stars 19 forks source link

compile failure for spectrum_match.cpp #1

Closed heejongkim closed 6 years ago

heejongkim commented 6 years ago

Hi, I'm having trouble with installing ann_solo on my multiple different computers with consistent failure. Please any advice would be greatly appreciated. Thanks! ===== pip output ===== Installing collected packages: ann-solo Running setup.py install for ann-solo ... error Complete output from command c:\ann_solo\python.exe -u -c "import setuptools, tokenize;file='C:\Users\ADMINI~1\AppData\Local\Temp\2\pip-install-1_l_j7rh\ann-solo\setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record C:\Users\ADMINI~1\AppData\Local\Temp\2\pip-record-myttq23i\install-record.txt --single-version-externally-managed --compile: running install running build running build_py creating build creating build\lib.win-amd64-3.7 creating build\lib.win-amd64-3.7\ann_solo copying ann_solo\ann_solo.py -> build\lib.win-amd64-3.7\ann_solo copying ann_solo\config.py -> build\lib.win-amd64-3.7\ann_solo copying ann_solo\plot_ssm.py -> build\lib.win-amd64-3.7\ann_solo copying ann_solo\reader.py -> build\lib.win-amd64-3.7\ann_solo copying ann_solo\spectral_library.py -> build\lib.win-amd64-3.7\ann_solo copying ann_solo\spectrum.py -> build\lib.win-amd64-3.7\ann_solo copying ann_solo\util.py -> build\lib.win-amd64-3.7\ann_solo copying ann_solo\writer.py -> build\lib.win-amd64-3.7\ann_solo copying ann_solo__init__.py -> build\lib.win-amd64-3.7\ann_solo running build_ext skipping 'ann_solo\spectrum_match.cpp' Cython extension (up-to-date) building 'ann_solo.spectrum_match' extension creating build\temp.win-amd64-3.7 creating build\temp.win-amd64-3.7\Release creating build\temp.win-amd64-3.7\Release\ann_solo C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -Ic:\ann_solo\lib\site-packages\numpy\core\include -Ic:\ann_solo\include -Ic:\ann_solo\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\winrt" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\winrt" /EHsc /Tpann_solo\spectrum_match.cpp /Fobuild\temp.win-amd64-3.7\Release\ann_solo\spectrum_match.obj -O3 -march=native -ffast-math -fno-associative-math -std=c++14 cl : Command line warning D9002 : ignoring unknown option '-O3' cl : Command line warning D9002 : ignoring unknown option '-march=native' cl : Command line warning D9002 : ignoring unknown option '-ffast-math' cl : Command line warning D9002 : ignoring unknown option '-fno-associative-math' cl : Command line warning D9002 : ignoring unknown option '-std=c++14' spectrum_match.cpp c:\ann_solo\lib\site-packages\numpy\core\include\numpy\npy_1_7_deprecated_api.h(12) : Warning Msg: Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION ann_solo\spectrum_match.cpp(3136): warning C4244: 'argument': conversion from 'Py_ssize_t' to 'unsigned int', possible loss of data ann_solo\spectrum_match.cpp(3285): warning C4244: 'argument': conversion from 'Py_ssize_t' to 'unsigned int', possible loss of data C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -Ic:\ann_solo\lib\site-packages\numpy\core\include -Ic:\ann_solo\include -Ic:\ann_solo\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\winrt" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\winrt" /EHsc /Tpann_solo/SpectrumMatch.cpp /Fobuild\temp.win-amd64-3.7\Release\ann_solo/SpectrumMatch.obj -O3 -march=native -ffast-math -fno-associative-math -std=c++14 cl : Command line warning D9002 : ignoring unknown option '-O3' cl : Command line warning D9002 : ignoring unknown option '-march=native' cl : Command line warning D9002 : ignoring unknown option '-ffast-math' cl : Command line warning D9002 : ignoring unknown option '-fno-associative-math' cl : Command line warning D9002 : ignoring unknown option '-std=c++14' SpectrumMatch.cpp ann_solo/SpectrumMatch.cpp(21): error C2131: expression did not evaluate to a constant ann_solo/SpectrumMatch.cpp(21): note: failure was caused by a read of a variable outside its lifetime ann_solo/SpectrumMatch.cpp(21): note: see usage of 'num_shifts' ann_solo/SpectrumMatch.cpp(24): error C3863: array type 'unsigned int [num_shifts]' is not assignable ann_solo/SpectrumMatch.cpp(26): error C2131: expression did not evaluate to a constant ann_solo/SpectrumMatch.cpp(26): note: failure was caused by a read of a variable outside its lifetime ann_solo/SpectrumMatch.cpp(26): note: see usage of 'num_shifts' ann_solo/SpectrumMatch.cpp(27): error C3863: array type 'double [num_shifts]' is not assignable ann_solo/SpectrumMatch.cpp(30): error C3863: array type 'double [num_shifts]' is not assignable ann_solo/SpectrumMatch.cpp(53): error C2668: 'fabs': ambiguous call to overloaded function C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\cmath(397): note: could be 'long double fabs(long double) noexcept' C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\cmath(103): note: or 'float fabs(float) noexcept' C:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\ucrt\corecrt_math.h(477): note: or 'double fabs(double)' C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\xtgmath.h(97): note: or '::std::enable_if<std::is_integral<double [num_shifts]>::value,double>::type fabs<double [num_shifts]>(_Ty)' with [ _Ty=double [num_shifts] ] ann_solo/SpectrumMatch.cpp(53): note: while trying to match the argument list '(double [num_shifts])' ann_solo/SpectrumMatch.cpp(82): error C2027: use of undefined type 'std::tuple<double,unsigned int,_Unrefwrap<unsigned int(&)[num_shifts]>::type>' C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\tuple(220): note: see declaration of 'std::tuple<double,unsigned int,_Unrefwrap<unsigned int(&)[num_shifts]>::type>' ann_solo/SpectrumMatch.cpp(82): error C2664: 'void std::vector<std::tuple<float,unsigned int,unsigned int>,std::allocator<_Ty>>::push_back(_Ty &&)': cannot convert argument 1 from 'std::tuple<double,unsigned int,_Unrefwrap<unsigned int(&)[num_shifts]>::type>' to 'const std::tuple<float,unsigned int,unsigned int> &' with [ _Ty=std::tuple<float,unsigned int,unsigned int> ] ann_solo/SpectrumMatch.cpp(82): note: Reason: cannot convert from 'std::tuple<double,unsigned int,_Unrefwrap<unsigned int(&)[num_shifts]>::type>' to 'const std::tuple<float,unsigned int,unsigned int>' ann_solo/SpectrumMatch.cpp(82): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\bin\HostX86\x64\cl.exe' failed with exit status 2

----------------------------------------

Command "c:\ann_solo\python.exe -u -c "import setuptools, tokenize;file='C:\Users\ADMINI~1\AppData\Local\Temp\2\pip-install-1_l_j7rh\ann-solo\setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record C:\Users\ADMINI~1\AppData\Local\Temp\2\pip-record-myttq23i\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\ADMINI~1\AppData\Local\Temp\2\pip-install-1_l_j7rh\ann-solo\

bittremieux commented 6 years ago

Thanks for reporting the error.

It seems like the MSVC compiler is more strict than GCC, which I have successfully used on multiple platforms (Linux, OS X).

Unfortunately I don't have convenient access to a Windows computer to make sure my bug fix works, I'll probably only be able to do that next week.

In the mean time you could try to compile using GCC in MinGW, that might work. (https://stackoverflow.com/questions/3297254/how-to-use-mingws-gcc-compiler-when-installing-python-package-using-pip)

bittremieux commented 6 years ago

It should be fixed in version 0.1.3, which can now be installed via pip. Let me know if you run into any more problems.

heejongkim commented 6 years ago

@bittremieux Perfect! It just worked! Thank you so much!