wzpan / wukong-robot

🤖 wukong-robot 是一个简单、灵活、优雅的中文语音对话机器人/智能音箱项目,支持ChatGPT多轮对话能力,还可能是首个支持脑机交互的开源智能音箱项目。
https://wukong.hahack.com/
MIT License
6.33k stars 1.34k forks source link

ModuleNotFoundError: No module named '_snowboydetect' #291

Open pengzhiqiang110 opened 1 year ago

pengzhiqiang110 commented 1 year ago

我都生成了_snowboydetect.so这个文件,然后 python3 wukong.py 还是不行 下面是执行的记录 (wukong-myenv) pd1@pengzhiqiangdeMacBook-Pro wukong-robot % cd $HOME

(wukong-myenv) pd1@pengzhiqiangdeMacBook-Pro ~ % wget https://wzpan-1253537070.cos.ap-guangzhou.myqcloud.com/wukong/snowboy.tar.bz2 --2023-09-13 15:14:51-- https://wzpan-1253537070.cos.ap-guangzhou.myqcloud.com/wukong/snowboy.tar.bz2 正在解析主机 wzpan-1253537070.cos.ap-guangzhou.myqcloud.com (wzpan-1253537070.cos.ap-guangzhou.myqcloud.com)... 27.155.119.166, 27.155.119.180, 27.155.119.179, ... 正在连接 wzpan-1253537070.cos.ap-guangzhou.myqcloud.com (wzpan-1253537070.cos.ap-guangzhou.myqcloud.com)|27.155.119.166|:443... 已连接。 已发出 HTTP 请求,正在等待回应... 200 OK 长度:27404385 (26M) [application/x-bzip2] 正在保存至: “snowboy.tar.bz2.2”

snowboy.tar.bz2.2 100%[===============================>] 26.13M 6.99MB/s 用时 5.0s

2023-09-13 15:14:56 (5.19 MB/s) - 已保存 “snowboy.tar.bz2.2” [27404385/27404385])

(wukong-myenv) pd1@pengzhiqiangdeMacBook-Pro ~ % tar -xvjf snowboy.tar.bz2 x snowboy/ x snowboy/.npmignore x snowboy/README_commercial.md x snowboy/.DS_Store x snowboy/swig/ x snowboy/README_ZH_CN.md x snowboy/LICENSE x snowboy/binding.gyp x snowboy/include/ x snowboy/resources/ x snowboy/MANIFEST.in x snowboy/README.md x snowboy/setup.py x snowboy/.gitignore x snowboy/package.json x snowboy/scripts/ x snowboy/lib/ x snowboy/tsconfig.json x snowboy/.travis.yml x snowboy/lib/ubuntu64/ x snowboy/lib/.DS_Store x snowboy/lib/osx/ x snowboy/lib/aarch64-ubuntu1604/ x snowboy/lib/rpi/ x snowboy/lib/ios/ x snowboy/lib/android/ x snowboy/lib/node/ x snowboy/lib/node/SnowboyDetectNative.d.ts x snowboy/lib/node/node-pre-gyp.d.ts x snowboy/lib/node/index.ts x snowboy/lib/android/armv8-aarch64/ x snowboy/lib/android/armv7a/ x snowboy/lib/android/armv7a/libsnowboy-detect.a x snowboy/lib/android/armv8-aarch64/libsnowboy-detect.a x snowboy/lib/ios/libsnowboy-detect.a x snowboy/lib/rpi/libsnowboy-detect.a x snowboy/lib/aarch64-ubuntu1604/libsnowboy-detect.a x snowboy/lib/osx/libsnowboy-detect.a x snowboy/lib/ubuntu64/libsnowboy-detect.a x snowboy/scripts/publish-node.sh x snowboy/scripts/install_swig.sh x snowboy/resources/.DS_Store x snowboy/resources/snowboy.raw x snowboy/resources/alexa/ x snowboy/resources/models/ x snowboy/resources/common.res x snowboy/resources/dong.wav x snowboy/resources/snowboy.wav x snowboy/resources/ding.wav x snowboy/resources/models/smart_mirror.umdl x snowboy/resources/models/view_glass.umdl x snowboy/resources/models/neoya.umdl x snowboy/resources/models/jarvis.umdl x snowboy/resources/models/hey_extreme.umdl x snowboy/resources/models/snowboy.umdl x snowboy/resources/models/computer.umdl x snowboy/resources/models/subex.umdl x snowboy/resources/alexa/alexa-avs-sample-app/ x snowboy/resources/alexa/alexa_02092017.umdl x snowboy/resources/alexa/SnowboyAlexaDemo.apk x snowboy/resources/alexa/alexa-avs-sample-app/avs-kittai.patch x snowboy/resources/alexa/alexa-avs-sample-app/alexa.umdl x snowboy/include/snowboy-detect.h x snowboy/swig/.DS_Store x snowboy/swig/Python3/ x snowboy/swig/Python3/snowboy-detect-swig.i x snowboy/swig/Python3/Makefile (wukong-myenv) pd1@pengzhiqiangdeMacBook-Pro ~ % cd snowboy/swig/Python3 (wukong-myenv) pd1@pengzhiqiangdeMacBook-Pro Python3 % make make: Nothing to be done for `all'. (wukong-myenv) pd1@pengzhiqiangdeMacBook-Pro Python3 % ls | grep -E '^(M|m)akefile$'

Makefile (wukong-myenv) pd1@pengzhiqiangdeMacBook-Pro Python3 % open Makefile (wukong-myenv) pd1@pengzhiqiangdeMacBook-Pro Python3 % (wukong-myenv) pd1@pengzhiqiangdeMacBook-Pro Python3 % cp _snowboydetect.so wukon-robot的根目录/snowboy/ cp: directory wukon-robot的根目录/snowboy does not exist (wukong-myenv) pd1@pengzhiqiangdeMacBook-Pro Python3 % cp _snowboydetect.so /Users/pd1/wukong-robot/snowboy/ (wukong-myenv) pd1@pengzhiqiangdeMacBook-Pro Python3 % cd $HOME

(wukong-myenv) pd1@pengzhiqiangdeMacBook-Pro ~ % cd /Users/pd1/wukong-robot (wukong-myenv) pd1@pengzhiqiangdeMacBook-Pro wukong-robot % python3 wukong.py Traceback (most recent call last): File "/Users/pd1/wukong-robot/snowboy/snowboydetect.py", line 17, in swig_import_helper return importlib.import_module(mname) File "/opt/homebrew/Caskroom/miniforge/base/envs/wukong-myenv/lib/python3.8/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 975, in _find_and_load_unlocked File "", line 657, in _load_unlocked File "", line 556, in module_from_spec File "", line 1166, in create_module File "", line 219, in _call_with_frames_removed ImportError: dlopen(/Users/pd1/wukong-robot/snowboy/_snowboydetect.so, 0x0002): symbol not found in flat namespace '__ZN7snowboy10SnowboyVad12SetAudioGainEf'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "wukong.py", line 11, in from robot.Conversation import Conversation File "/Users/pd1/wukong-robot/robot/Conversation.py", line 14, in from snowboy import snowboydecoder File "/Users/pd1/wukong-robot/snowboy/snowboydecoder.py", line 5, in from . import snowboydetect File "/Users/pd1/wukong-robot/snowboy/snowboydetect.py", line 21, in _snowboydetect = swig_import_helper() File "/Users/pd1/wukong-robot/snowboy/snowboydetect.py", line 19, in swig_import_helper return importlib.import_module("_snowboydetect") File "/opt/homebrew/Caskroom/miniforge/base/envs/wukong-myenv/lib/python3.8/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) ModuleNotFoundError: No module named '_snowboydetect' (wukong-myenv) pd1@pengzhiqiangdeMacBook-Pro wukong-robot % python3 wukong.py help Traceback (most recent call last): File "/Users/pd1/wukong-robot/snowboy/snowboydetect.py", line 17, in swig_import_helper return importlib.import_module(mname) File "/opt/homebrew/Caskroom/miniforge/base/envs/wukong-myenv/lib/python3.8/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 975, in _find_and_load_unlocked File "", line 657, in _load_unlocked File "", line 556, in module_from_spec File "", line 1166, in create_module File "", line 219, in _call_with_frames_removed ImportError: dlopen(/Users/pd1/wukong-robot/snowboy/_snowboydetect.so, 0x0002): symbol not found in flat namespace '__ZN7snowboy10SnowboyVad12SetAudioGainEf'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "wukong.py", line 11, in from robot.Conversation import Conversation File "/Users/pd1/wukong-robot/robot/Conversation.py", line 14, in from snowboy import snowboydecoder File "/Users/pd1/wukong-robot/snowboy/snowboydecoder.py", line 5, in from . import snowboydetect File "/Users/pd1/wukong-robot/snowboy/snowboydetect.py", line 21, in _snowboydetect = swig_import_helper() File "/Users/pd1/wukong-robot/snowboy/snowboydetect.py", line 19, in swig_import_helper return importlib.import_module("_snowboydetect") File "/opt/homebrew/Caskroom/miniforge/base/envs/wukong-myenv/lib/python3.8/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) ModuleNotFoundError: No module named '_snowboydetect'

wzpan commented 1 year ago

(wukong-myenv) pd1@pengzhiqiangdeMacBook-Pro ~ % cd snowboy/swig/Python3 (wukong-myenv) pd1@pengzhiqiangdeMacBook-Pro Python3 % make make: Nothing to be done for `all'.

你这上面的错误看起来是之前曾经 make 过,但有可能没有真正构建好。试试改用 make -B 替代 make 进行 snowboy 编译操作。

atjason commented 1 year ago

+1 之前能正常运行,最新升级后,就出现了这个错误。重新 make 后,还是一样的问题。正在使用 make -B 再来一遍。

ZhouHr commented 10 months ago

请问解决了吗?我在新版本同样遇到这个问题:

$ python3 wukong.py Traceback (most recent call last): File "/data/service/wukong-robot/snowboy/snowboydetect.py", line 17, in swig_import_helper return importlib.import_module(mname) File "/usr/lib/python3.9/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1030, in _gcd_import File "", line 1007, in _find_and_load File "", line 986, in _find_and_load_unlocked File "", line 666, in _load_unlocked File "", line 565, in module_from_spec File "", line 1108, in create_module File "", line 228, in _call_with_frames_removed ImportError: libpython3.4m.so.1.0: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/data/service/wukong-robot/wukong.py", line 11, in from robot.Conversation import Conversation File "/data/service/wukong-robot/robot/Conversation.py", line 14, in from snowboy import snowboydecoder File "/data/service/wukong-robot/snowboy/snowboydecoder.py", line 5, in from . import snowboydetect File "/data/service/wukong-robot/snowboy/snowboydetect.py", line 21, in _snowboydetect = swig_import_helper() File "/data/service/wukong-robot/snowboy/snowboydetect.py", line 19, in swig_import_helper return importlib.import_module("_snowboydetect") File "/usr/lib/python3.9/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) ModuleNotFoundError: No module named '_snowboydetect'

编译_snowboydetect:

make swig -I../../ -c++ -python -o snowboy-detect-swig.cc snowboy-detect-swig.i g++ -I/usr/local/miniconda3/include/python3.4m -I/usr/local/miniconda3/include/python3.4m -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I../../ -O3 -fPIC -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++0x -c snowboy-detect-swig.cc cc1plus: warning: command-line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ ^[[Og++ -I../../ -O3 -fPIC -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++0x -shared snowboy-detect-swig.o \ ../..//lib/rpi/libsnowboy-detect.a -L/usr/local/miniconda3/lib -lpython3.4m -lpthread -ldl -lutil -lm -Xlinker -export-dynamic -lm -ldl -lf77blas -lcblas -llapack -latlas -o _snowboydetect.so

cp _snowboydetect.so wukong-robot/snowboy/