Menu

building sphinxbase python module under windo

Help
asr2010
2012-03-17
2013-02-09
  • asr2010

    asr2010 - 2012-03-17

    I am not able to build and install the sphinxbase python module under windows
    (7/64bits)
    I tried the snaptshot, truck, and 0.7 and it didn't work.
    I have visual studio 2010 and python2.6
    I was trying to build the module using the following command:

    python setup_win32.py build

    but I got the following message "unable to find vcvarsall.bat"

    I have installed visual studio 2008 and I got another error from the linker:

    C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\link.exe /DLL
    /nologo /INCREMENTAL:NO /LIBPATH:../lib/debug /LIBPATH:C:\Python26\libs
    /LIBPATH:C:\Python26\PCbuild sphinxbase.l
    ib /EXPORT:initsphinxbase build\temp.win32-2.6\Release\sphinxbase.obj
    /OUT:build\lib.win32-2.6\sphinxbase.pyd
    /IMPLIB:build\temp.win32-2.6\Release\sphinxbase.lib /MANIFESTFILE:build\tem
    p.win32-2.6\Release\sphinxbase.pyd.manifest
    LINK : fatal error LNK1181: cannot open input file 'sphinxbase.lib'
    error: command '"C:\Program Files (x86)\Microsoft Visual Studio
    9.0\VC\BIN\link.exe"' failed with exit status 1181

    I tried another compiler MinGW32 and I typed the following:

    python setup_win32.py build -c mingw32

    but it didn't work as well and I got the following error:

    c:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -DWIN32=1 -I../include
    -I../include/win32 -IC:\Python26\include -IC:\Python26\PC -c sphinxbase.c -o
    build\temp.win32-2.6\Release\sphinxba
    se.o
    cc1.exe: error: unrecognized command line option '-mno-cygwin'
    error: command 'gcc' failed with exit status 1

    So I need some help about how to install the sphinxbase python module.

     
  • Nickolay V. Shmyrev

    C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\link.exe /DLL
    /nologo /INCREMENTAL:NO /LIBPATH:../lib/debug /LIBPATH:C:\Python26\libs
    /LIBPATH:C:\Python26\PCbuild sphinxbase.l ib /EXPORT:initsphinxbase
    build\temp.win32-2.6\Release\sphinxbase.obj
    /OUT:build\lib.win32-2.6\sphinxbase.pyd
    /IMPLIB:build\temp.win32-2.6\Release\sphinxbase.lib /MANIFESTFILE:build\tem
    p.win32-2.6\Release\sphinxbase.pyd.manifest LINK : fatal error LNK1181: cannot
    open input file 'sphinxbase.lib' error: command '"C:\Program Files
    (x86)\Microsoft Visual Studio 9.0\VC\BIN\link.exe"' failed with exit status
    1181

    It says it failed to load the library from the location specified in a command
    line. You need to read the output and put the library in the proper folder.

    c:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -DWIN32=1 -I../include
    -I../include/win32 -IC:\Python26\include -IC:\Python26\PC -c sphinxbase.c -o
    build\temp.win32-2.6\Release\sphinxba se.o cc1.exe: error: unrecognized
    command line option '-mno-cygwin' error: command 'gcc' failed with exit status
    1

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

     
  • Pavel Kulikov

    Pavel Kulikov - 2012-10-15

    Have similar promlem
    Win, triyng to sphinxbase install for python 2.7

    C:!!!!WORK\sphinxbase\python>python setup_win32.py install
    running install
    running bdist_egg
    running egg_info
    writing SphinxBase.egg-info\PKG-INFO
    writing top-level names to SphinxBase.egg-info\top_level.txt
    writing dependency_links to SphinxBase.egg-info\dependency_links.txt
    reading manifest file 'SphinxBase.egg-info\SOURCES.txt'
    writing manifest file 'SphinxBase.egg-info\SOURCES.txt'
    installing library code to build\bdist.win32\egg
    running install_lib
    running build_ext
    building 'sphinxbase' extension
    c:\mingw\bin\gcc.exe -mno-cygwin -mdll -O -Wall -DWIN32=1 -I../include -I../incl
    ude/win32 -Ig:\python27\include -Ig:\python27\PC -c sphinxbase.c -o build\temp.w
    in32-2.7\Release\sphinxbase.o
    sphinxbase.c:851: warning: 'pyx_doc_10sphinxbase_7LogMathdealloc' defined
    but not used
    sphinxbase.c:1729: warning: '
    pyx_doc_10sphinxbase_10NGramModel
    dealloc
    ' de
    fined but not used
    writing build\temp.win32-2.7\Release\sphinxbase.def
    c:\mingw\bin\gcc.exe -shared -s build\temp.win32-2.7\Release\sphinxbase.o build\ temp.win32-2.7\Release\sphinxbase.def -L../lib/debug -Lg:\python27\libs -Lg:\pyt
    hon27\PCbuild -lsphinxbase -lpython27 -lmsvcr90 -o build\lib.win32-2.7\sphinxbas
    e.pyd
    c:/mingw/bin/../lib/gcc/mingw32/4.3.3/../../../../mingw32/bin/ld.exe: cannot fin
    d -lsphinxbase
    collect2: ld returned 1 exit status
    error: command 'gcc' failed with exit status 1

    As i see, there is no sphinxbase.lib in directories, but where can i find it?

    I'm new in compiling, so need help.
    Thanks.

     
  • Nickolay V. Shmyrev

    As i see, there is no sphinxbase.lib in directories, but where can i find it?

    You can build it using VS2010 as a part of sphinxbase build process. See README in the top folder.

     
  • Pavel Kulikov

    Pavel Kulikov - 2012-10-16

    Thats work, thanks.

    Now, when i try install pocketsphinx, installer tells, that he cant find "sphinx_config.h".

    I find one in \sphinxbase\include\win32
    and copy it po pocket directory.

    Installing seems to work correct:


    C:!!!!WORK\pocketsphinx\python>python setup_win32.py install
    running install
    running bdist_egg
    running egg_info
    creating PocketSphinx.egg-info
    writing PocketSphinx.egg-info\PKG-INFO
    writing top-level names to PocketSphinx.egg-info\top_level.txt
    writing dependency_links to PocketSphinx.egg-info\dependency_links.txt
    writing manifest file 'PocketSphinx.egg-info\SOURCES.txt'
    reading manifest file 'PocketSphinx.egg-info\SOURCES.txt'
    writing manifest file 'PocketSphinx.egg-info\SOURCES.txt'
    installing library code to build\bdist.win32\egg
    running install_lib
    running build_ext
    building 'pocketsphinx' extension
    creating build
    creating build\temp.win32-2.7
    creating build\temp.win32-2.7\Release
    c:\mingw\bin\gcc.exe -mno-cygwin -mdll -O -Wall -I../include -I../python -I../..
    /sphinxbase/include -I../../sphinxbase/win32/include -Ig:\python27\include -Ig:\ python27\PC -c pocketsphinx.c -o build\temp.win32-2.7\Release\pocketsphinx.o
    pocketsphinx.c: In function 'pyx_f_12pocketsphinx_7LatNode_set_node':
    pocketsphinx.c:1167: warning: assignment discards qualifiers from pointer target
    type
    pocketsphinx.c:1176: warning: assignment discards qualifiers from pointer target
    type
    pocketsphinx.c: In function '
    pyx_f_12pocketsphinx_7LatLink_set_link':
    pocketsphinx.c:1894: warning: assignment discards qualifiers from pointer target
    type
    pocketsphinx.c:1903: warning: assignment discards qualifiers from pointer target
    type
    pocketsphinx.c: In function 'pyx_pf_12pocketsphinx_7Decoder_process_raw':
    pocketsphinx.c:4615: warning: assignment from incompatible pointer type
    pocketsphinx.c: At top level:
    pocketsphinx.c:5576: warning: '
    pyx_pf_10sphinxbase_10NGramModel_2lwget' d
    efined but not used
    pocketsphinx.c:5600: warning: '
    pyx_pf_10sphinxbase_10NGramModel_3wip
    get'
    defined but not used
    pocketsphinx.c:5624: warning: '
    pyx_pf_10sphinxbase_10NGramModel_2uwget' d
    efined but not used
    pocketsphinx.c:5656: warning: '
    pyx_pf_10sphinxbase_9NGramIter_8log_prob
    get_
    _' defined but not used
    pocketsphinx.c:5680: warning: 'pyx_pf_10sphinxbase_9NGramIter_8log_bowtget_
    _' defined but not used
    pocketsphinx.c:5712: warning: '__pyx_pf_10sphinxbase_9NGramIter_5words
    get
    '
    defined but not used
    writing build\temp.win32-2.7\Release\pocketsphinx.def
    creating build\lib.win32-2.7
    c:\mingw\bin\gcc.exe -shared -s build\temp.win32-2.7\Release\pocketsphinx.o buil
    d\temp.win32-2.7\Release\pocketsphinx.def -L../bin/debug -L../../sphinxbase/lib/
    debug -Lg:\python27\libs -Lg:\python27\PCbuild -lpocketsphinx -lsphinxbase -lpyt
    hon27 -lmsvcr90 -o build\lib.win32-2.7\pocketsphinx.pyd
    creating build\bdist.win32
    creating build\bdist.win32\egg
    copying build\lib.win32-2.7\pocketsphinx.pyd -> build\bdist.win32\egg
    creating stub loader for pocketsphinx.pyd
    byte-compiling build\bdist.win32\egg\pocketsphinx.py to pocketsphinx.pyc
    creating build\bdist.win32\egg\EGG-INFO
    copying PocketSphinx.egg-info\PKG-INFO -> build\bdist.win32\egg\EGG-INFO
    copying PocketSphinx.egg-info\SOURCES.txt -> build\bdist.win32\egg\EGG-INFO
    copying PocketSphinx.egg-info\dependency_links.txt -> build\bdist.win32\egg\EGG-
    INFO
    copying PocketSphinx.egg-info\top_level.txt -> build\bdist.win32\egg\EGG-INFO
    writing build\bdist.win32\egg\EGG-INFO\native_libs.txt
    zip_safe flag not set; analyzing archive contents...
    creating dist
    creating 'dist\PocketSphinx-0.6-py2.7-win32.egg' and adding 'build\bdist.win32\e
    gg' to it
    removing 'build\bdist.win32\egg' (and everything under it)
    Processing PocketSphinx-0.6-py2.7-win32.egg
    Removing g:\python27\lib\site-packages\PocketSphinx-0.6-py2.7-win32.egg
    Copying PocketSphinx-0.6-py2.7-win32.egg to g:\python27\lib\site-packages
    PocketSphinx 0.6 is already the active version in easy-install.pth

    Installed g:\python27\lib\site-packages\pocketsphinx-0.6-py2.7-win32.egg
    Processing dependencies for PocketSphinx==0.6
    Finished processing dependencies for PocketSphinx==0.6


    But when i try to import pocketsphinx in Python, its pop up error:

    Traceback (most recent call last):
    File "C:!!!!WORK\Python\speech\easy_speech.py", line 1, in <module>
    import pocketsphinx as ps
    File "build\bdist.win32\egg\pocketsphinx.py", line 7, in <module>
    File "build\bdist.win32\egg\pocketsphinx.py", line 6, in bootstrap
    File "sphinxbase.pxd", line 150, in init pocketsphinx (pocketsphinx.c:7930)
    ValueError: PyCapsule_GetPointer called with invalid PyCapsule object
    [Finished in 0.1s with exit code 1]

    what did I do wrong?

     

    Last edit: Pavel Kulikov 2012-10-16
  • Nickolay V. Shmyrev

     
    • Pavel Kulikov

      Pavel Kulikov - 2012-10-17

      Thanks, but there nothing helpful.
      Python 2.6 not really good decision.

       
      • Nickolay V. Shmyrev

        This thread also says that for 2.7 you need to recompile c glue code with cython.

         

        Last edit: Nickolay V. Shmyrev 2012-10-17
        • Pavel Kulikov

          Pavel Kulikov - 2012-10-17

          Cython, yes.

          Can you write guide, how to get new .c files

          Cython is installed. Reinstall with Pyhton stops without .c, and i cant understand, how to get it.

          Sorry for very basic questions.

          P.S.
          got it

          "cython sphinxbase.pyx"

          P.P.S.
          Sphinxbase ok, but pocket get errors:

          P.P.P.S.
          got it, copy sphinxbase.pxd in pocket dir.

          Import ok now, thanks!

           

          Last edit: Pavel Kulikov 2012-10-17
  • Pavel Kulikov

    Pavel Kulikov - 2012-10-18

    import work good,
    Decoder init too.

    But when im try to decode_raw(), Python crashed without any info and with 255 code.
    Win8x64

    WinXP32 on clear install same thing.

     

    Last edit: Pavel Kulikov 2012-10-18
    • Nickolay V. Shmyrev

      Does pocketsphinx/python/ps_test.py work for you?

      Provide application log to understand at what point the script crashed.

      Add additional log messages to source code in order to understand in which exact function it crashes.

       
  • shiv

    shiv - 2013-02-08

    I keep getting an ImportError: DLL load failed: The specified module could not be found.
    when i try to run sb_test.py to test if sphinxbase installed properly on windows
    trying to install for python 2.7
    My install steps:

    1) extracted sphinxbase-0.8.tar.gz renamed it to sphinxbase
    2) rebuild all sphinxbase.sln using visual studio 2010
    3) changed setup_win32.py to include my build location for the value "library_dirs" for visual studio 2010
    4) python setup_win32.py install and it says:

    Installed c:\python27\lib\site-packages\sphinxbase-0.6-py2.7-win32.egg
    Processing dependencies for SphinxBase==0.6
    Finished processing dependencies for SphinxBase==0.6

    but when I python sb_test.py i get error:

    File "sb_test.py", line 3, in <module>
    import sphinxbase
    File "build\bdist.win32\egg\sphinxbase.py", line 7, in <module>
    File "build\bdist.win32\egg\sphinxbase.py", line 6, in bootstrap
    ImportError: DLL load failed: The specified module could not be found.

    I have checked my easy-install.pth and it has the value for sphinxbase in there..
    I'm kinda stumped so any help would be very much appreciated.

    P.S. why does it say sphinxbase 0.6?? shouldnt it be 0.8?

    Thanks


    Ok I got sb_test.py to work the problem was I was giving setup_win32.py install command instead of the build cmd. so instead I needed to to setup_win32.py build and it worked fine afterwards ...

    but now pocketsphinx gives me a importerror:

    Traceback (most recent call last):
    File "ps_test.py", line 1, in <module>
    import pocketsphinx as ps
    ImportError: No module named pocketsphinx

    I installed pocketsphinx like i installed sphinxbase built using vs2010 modified setup_win32.py to include the directory for sphinxbase build.. copied sphinxbase.pxd in to pocketsphinx/python folder

     

    Last edit: shiv 2013-02-09
  • Nickolay V. Shmyrev

    import pocketsphinx as ps
    ImportError: No module named pocketsphinx
    

    It means you still miss binary files, probably you need to make sure that python can find them and all required dlls are present.

     

    Last edit: Nickolay V. Shmyrev 2013-02-09

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.