mattjj / pyhsmm

MIT License
546 stars 173 forks source link

pyhsmm compilation issue on windows #32

Closed dhanasekaran-anbalagan closed 9 years ago

dhanasekaran-anbalagan commented 9 years ago

Hi Guys,

I am trying to compile pyhsmm with windows I am getting error,

Please guide me How to fix this.

My Environment ::

Gnu Python-2.7 and [ Microsoft Visual Studio 11.0 ] windows 7 ( 64-bit ) Operating system.

C:\Users\localadmin\pyhsmm> C:\Python27\python.exe .\setup.py build_ext --inplace nning build_ext ilding 'internals.hmm_messages_interface' extension eating build eating build\temp.win32-2.7 eating build\temp.win32-2.7\Release eating build\temp.win32-2.7\Release\internals \Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ideps/Eigen3/ -I \Python27\lib\site-packages\numpy\core\include -IC:\Python27\include -IC:\Python27\PC /Tpinternals\hmm_messages_interf e.cpp /Fobuild\temp.win32-2.7\Release\internals\hmm_messages_interface.obj -Ofast -std=c++11 -DHMM_TEMPS_ON_HEAP -DNDE G -w : Command line warning D9025 : overriding '/Os' with '/Ot' : Command line warning D9025 : overriding '/W3' with '/w' : Command line warning D9002 : ignoring unknown option '-Of' : Command line warning D9002 : ignoring unknown option '-Oa' : Command line warning D9002 : ignoring unknown option '-std=c++11' m_messages_interface.cpp \python27\lib\site-packages\numpy\core\include\numpy\npy_1_7_deprecated_api.h(12) : Warning Msg: Using deprecated NumP API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION \Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\xlocale(336) : warning C4530: C++ exception handler used, ut unwind semantics are not enabled. Specify /EHsc \users\localadmin\pyhsmm\internals\nptypes.h(24) : error C2988: unrecognizable template declaration/definition \users\localadmin\pyhsmm\internals\nptypes.h(24) : error C2059: syntax error : 'using' \users\localadmin\pyhsmm\internals\nptypes.h(30) : error C2988: unrecognizable template declaration/definition \users\localadmin\pyhsmm\internals\nptypes.h(30) : error C2059: syntax error : 'using' \users\localadmin\pyhsmm\internals\nptypes.h(36) : error C2988: unrecognizable template declaration/definition \users\localadmin\pyhsmm\internals\nptypes.h(36) : error C2059: syntax error : 'using' \users\localadmin\pyhsmm\internals\nptypes.h(61) : error C2988: unrecognizable template declaration/definition \users\localadmin\pyhsmm\internals\nptypes.h(61) : error C2059: syntax error : 'using' \users\localadmin\pyhsmm\internals\nptypes.h(67) : error C2988: unrecognizable template declaration/definition \users\localadmin\pyhsmm\internals\nptypes.h(67) : error C2059: syntax error : 'using' \users\localadmin\pyhsmm\internals\nptypes.h(73) : error C2988: unrecognizable template declaration/definition \users\localadmin\pyhsmm\internals\nptypes.h(73) : error C2059: syntax error : 'using' ternals\hmm_messages_interface.cpp(5120) : error C2664: 'hmmc::sample_forwards_log' : cannot convert parame r 7 from 'pyx_t_5numpy_int32_t ' to 'int32_t ' with [ FloatType=float ] Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast ternals\hmm_messages_interface.cpp(5419) : error C2664: 'hmmc::sample_forwards_log' : cannot convert parame r 7 from 'pyx_t_5numpy_int32_t ' to 'int32_t ' with [ FloatType=double ] Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast ternals\hmm_messages_interface.cpp(8753) : error C2664: 'hmmc::sample_backwards_normalized' : cannot conver parameter 5 from 'pyx_t_5numpy_int32_t ' to 'int32_t ' with [ FloatType=float ] Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast ternals\hmm_messages_interface.cpp(9017) : error C2664: 'hmmc::sample_backwards_normalized' : cannot conver parameter 5 from 'pyx_t_5numpy_int32_t ' to 'int32_t ' with [ FloatType=double ] Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast ternals\hmm_messages_interface.cpp(12382) : error C2664: 'hmmc::viterbi' : cannot convert parameter 6 from _pyx_t_5numpy_int32_t ' to 'int32_t ' with [ FloatType=float ] Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast ternals\hmm_messages_interface.cpp(12578) : error C2664: 'hmmc::viterbi' : cannot convert parameter 6 from _pyx_t_5numpy_int32_t ' to 'int32_t ' with [ FloatType=double ] Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast ror: command '"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN\cl.exe"' failed with exit status 2 C:\Users\localadmin\pyhsmm>

mattjj commented 9 years ago

There might be multiple problems here, but one of them is

: Command line warning D9002 : ignoring unknown option '-std=c++11

It looks like your compiler doesn't support C++11. Can you change compilers, maybe to gcc (mingw)?

dhanasekaran-anbalagan commented 9 years ago

Hi , thanks for you reply, currently I am trying with MinGW gcc, I am getting gcc: error: unrecognized command line option '-mno-cygwin'

PS C:\Users\dhana\pyhsmm> gcc --version gcc.exe (GCC) 4.8.1 Copyright (C) 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

PS C:\Users\dhana\pyhsmm> python.exe setup.py install running install running build running build_ext building 'internals.hmm_messages_interface' extension C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -Ideps/Eigen3/ -IC:\Python27\lib\site-packages\numpy\core\include -IC:\P ython27\include -IC:\Python27\PC -c internals\hmm_messages_interface.cpp -o build\temp.win32-2.7\Release\internals\hmm_m essages_interface.o -Ofast -std=c++11 -DHMM_TEMPS_ON_HEAP -DNDEBUG -w gcc: error: unrecognized command line option '-mno-cygwin' error: command 'gcc' failed with exit status 1 PS C:\Users\dhana\pyhsmm>

Please guide me. How to fix this.

mattjj commented 9 years ago

Have you tried googling the problem?

https://stackoverflow.com/questions/6034390/compiling-with-cython-and-mingw-produces-gcc-error-unrecognized-command-line-o/6035864#6035864

dhanasekaran-anbalagan commented 9 years ago

Hi After stackoverflow link I removed -mno-cygwin option,

after I am getting build error: '::hypot' has not been declared

I am using numpy version == 1.8.2

C:\MinGW\bin\gcc.exe -mdll -O -Wall -Ideps/Eigen3/ -IC:\Python27\lib\site-packages\numpy\core\include -IC:\Python27\incl ude -IC:\Python27\PC -c internals\hmm_messages_interface.cpp -o build\temp.win32-2.7\Release\internals\hmm_messages_inte rface.o -Ofast -std=c++11 -DHMM_TEMPS_ON_HEAP -DNDEBUG -w In file included from C:\Python27\lib\site-packages\numpy\core\include/numpy/ndarraytypes.h:1761:0, from C:\Python27\lib\site-packages\numpy\core\include/numpy/ndarrayobject.h:17, from C:\Python27\lib\site-packages\numpy\core\include/numpy/arrayobject.h:4, from internals\hmm_messages_interface.cpp:268: C:\Python27\lib\site-packages\numpy\core\include/numpy/npy_1_7_deprecated_api.h:13:79: note: #pragma message: C:\Python2 7\lib\site-packages\numpy\core\include/numpy/npy_1_7_deprecated_api.h(12) : Warning Msg: Using deprecated NumPy API, dis able it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION") ^ In file included from c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\complex:44:0, from deps/Eigen3/Eigen/Core:56, from internals\hmm_messages.h:4, from internals\hmm_messages_interface.cpp:276: c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\cmath:1093:11: error: '::hypot' has not been declared using ::hypot;

https://gist.githubusercontent.com/dhanasekaran-anbalagan/ccf43b86948e4d718a3e/raw/a9eb65942eda3bbf9883436ee8baf32c3763fb04/build_error

mattjj commented 9 years ago

That was one of the bugs in #27, so check out that issue.

Btw, I can't be very helpful here because I don't have a Windows machine to test on (and I haven't ever run this library or any other Python code on Windows!).

dhanasekaran-anbalagan commented 9 years ago

Hi Mattji,

Have update latest code, It's breaks can you check

PS C:\Users\dhana\pyhsmm> python.exe .\setup.py build_ext --inplace C:\Python27\lib\distutils\dist.py:267: UserWarning: Unknown distribution option: 'install_requires' warnings.warn(msg) running build_ext building 'pyhsmm\internals.hmm_messages_interface' extension creating build\temp.win32-2.7 creating build\temp.win32-2.7\Release creating build\temp.win32-2.7\Release\pyhsmm creating build\temp.win32-2.7\Release\pyhsmm\internals C:\MinGW\bin\gcc.exe -mdll -O -Wall -Ipyhsmm/deps/Eigen3/ -IC:\Python27\lib\site-packages\numpy\core\include -IC:\Python 27\include -IC:\Python27\PC -c pyhsmm\internals\hmm_messages_interface.cpp -o build\temp.win32-2.7\Release\pyhsmm\intern als\hmm_messages_interface.o -O3 -std=c++11 -DNDEBUG -w -DHMM_TEMPS_ON_HEAP gcc: error: pyhsmm\internals\hmm_messages_interface.cpp: No such file or directory gcc: fatal error: no input files compilation terminated. error: command 'gcc' failed with exit status 1 PS C:\Users\dhana\pyhsmm>

last commit ::

commit 6d63cc600ed2ad260fd24dbcc9536a6f1fb3d20b Author: Matthew Johnson mattjj@csail.mit.edu Date: Fri Feb 27 00:25:53 2015 -0500

remove test_paralleltempering
mattjj commented 9 years ago

We just changed the build procedure last night and haven't documented it yet. To build from git, you need to do

python setup.py build_ext --inplace --with-cython

I'll try to improve it over the next couple of days, but in the meantime if it gives you trouble I suggest just working on an older commit instead of the current master.

mattjj commented 9 years ago

Concretely, just check out commit fc32110 to avoid all the new install stuff.

mattjj commented 9 years ago

I should also say that, at least on *nix and OS X, you can now do pip install pyhsmm. I bet that will break on Windows, but maybe it's worth a shot.

yarden commented 9 years ago

I believe it'll break on windows at least in part because you use Unix path delimiters in setup.py instead of os.path.join - but I'm not sure, haven't used Windows in ages.

mattjj commented 9 years ago

Good catch. That's only a problem in the newest setup.py file though, not the older ones. I meant that pip won't magically solve the hypot problem.

EDIT: Hm, I guess path delimiters may have been a problem with the cythonize globbing pattern, too!

dhanasekaran-anbalagan commented 9 years ago

Hi Matt

Thanks for your fast response

We tried compiling from the commit fc32110, we get the error mentioned in https://github.com/mattjj/pyhsmm/issues/27 . The console output is available in http://paste.ubuntu.com/10455821/ When we tried to debug further, the commits made to address the issue https://github.com/mattjj/pyhsmm/commit/aa6ca3d419b1a3788d29d7a9822c2eaead9122f3 did not get to the master. We tried compiling from the mentioned branch windows-weirdness, it is throwing us a build error

~/pyhsmm (windows-weirdness) $ python setup.py build_ext --inplace --with-cython Traceback (most recent call last): File "setup.py", line 37, in extmodules = cythonize('**/.pyx') File "c:\Users\Dhana\pyhsmm\util\cyutil.py", line 105, in cythonize out = true_cythonize(_args,**kwargs) File "c:\Python27\lib\site-packages\Cython\Build\Dependencies.py", line 754, i n cythonize aliases=aliases) TypeError: create_extension_list() got an unexpected keyword argument 'language

Let us know how to proceed

dhanasekaran-anbalagan commented 9 years ago

Hi Matthew,

Any update on this,

Please guide me.

mattjj commented 9 years ago

You should probably stay on commit fc32110 and apply the windows-specific fixes discussed in #27 manually.

mattjj commented 9 years ago

I'm going to close this one. There are probably still Windows build problems, but they seem to change over time and we need someone with a Windows machine to investigate thoroughly.