SeanNaren / warp-ctc

Pytorch Bindings for warp-ctc
Apache License 2.0
757 stars 271 forks source link

ImportError: dynamic module does not define module export function (PyInit__warp_ctc) #100

Closed northeastsquare closed 5 years ago

northeastsquare commented 5 years ago

Hello, after install according README, I got:

from warpctc_pytorch import CTCLoss Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.7/site-packages/warpctc_pytorch-0.1-py3.7-linux-x86_64.egg/warpctc_pytorch/init.py", line 6, in from ._warp_ctc import * ImportError: dynamic module does not define module export function (PyInit__warp_ctc)

pytorch version 1.0.0, and python3.7

northeastsquare commented 5 years ago

Solved. use pytorch's cpp extension method

Nirvana93 commented 5 years ago

i meet the same problem with you, can you tell me more about how to solve this problem? and more about how to use pytorch's cpp extension method, thx

northeastsquare commented 5 years ago

Python has its c++ method, while pytorch have pytorch's own method. in pytorch_binding/setup.py, change as following: ` setup( name='warpctc', ext_modules=[

apparently pybind does not support submodules like warpctc._warpctc

    CppExtension('warpctc._warpctc', ['src/_warpctc.cpp'],
                 include_dirs=['../include'],
                 library_dirs=['build/lib'],
                 libraries=['warpctc'],
                 extra_link_args=[make_relative_rpath('lib')])
],
packages=find_packages(exclude=['tests']),
package_data={'warpctc': ['lib/libwarpctc' + shared_object_ext()]},

cmdclass={
    'build': Build,
    'build_deps': BuildDeps,
    'build_ext': BuildExtension,
    'clean': Clean,
})

`