No module named 'torch_baidu_ctc._C', ERROR when installing from source
Closed this issue · 1 comments
Python 3.6
Pytorch 0.4.1
CUDA 9.0
gcc 4.9
pip install torch-baidu-ctc works fine.
But installation from source and then the unit test results in error:
python -m unittest torch_baidu_ctc.test
ERROR: torch_baidu_ctc (unittest.loader._FailedTest)
ImportError: Failed to import test module: torch_baidu_ctc
Traceback (most recent call last):
File "/home/ds2pth041/anaconda3/lib/python3.6/unittest/loader.py", line 153, in loadTestsFromName
module = import(module_name)
File "/home/ds2pth041/pytorch-baidu-ctc/torch_baidu_ctc/init.py", line 4, in
import torch_baidu_ctc._C as _torch_baidu_ctc
ModuleNotFoundError: No module named 'torch_baidu_ctc._C'
Hi,
Are you trying to execute the tests from within the source directory? This will cause problems since Python will load the files in your current directory (the source directory) instead of the files installed, but the _C.so dynamic library is not in the source dir!
git clone https://github.com/jpuigcerver/pytorch-baidu-ctc
cd pytorch-baidu-ctc
python setup.py install
# DO NOT DO THIS, SINCE _C.so IS NOT PRESENT HERE:
python -m unittest torch_baidu_ctc.test
# DO THIS INSTEAD
cd $HOME # Or whatever directory you want, except the project source
python -m unittest torch_baidu_ctc.test
Let me know if this solves your issue. If not, I will reopen the bug.