sandesh bafna
sandesh bafna

Reputation: 31

I'm getting "no module named ad" error in python

I tried to import pocketsphinx and sphinx base but both of this shows error as "no module name ad" error I don't know what this "ad" is

code:

>>> import pocketsphinx

Traceback (most recent call last):
  File "<pyshell#4>", line 1, in <module>
    import pocketsphinx
  File "C:\Python27\lib\site-packages\pocketsphinx\__init__.py", line 35, in <module>
    from sphinxbase import *
  File "C:\Python27\lib\site-packages\sphinxbase\__init__.py", line 32, in <module>
    from .ad import *
  File "C:\Python27\lib\site-packages\sphinxbase\ad.py", line 35, in <module>
    _ad = swig_import_helper()
  File "C:\Python27\lib\site-packages\sphinxbase\ad.py", line 34, in swig_import_helper
    return importlib.import_module('_ad')
  File "C:\Python27\lib\importlib\__init__.py", line 37, in import_module
    __import__(name)
ImportError: No module named _ad
>>> import sphinxbase

Traceback (most recent call last):
  File "<pyshell#5>", line 1, in <module>
    import sphinxbase
  File "C:\Python27\lib\site-packages\sphinxbase\__init__.py", line 32, in <module>
    from .ad import *
  File "C:\Python27\lib\site-packages\sphinxbase\ad.py", line 35, in <module>
    _ad = swig_import_helper()
  File "C:\Python27\lib\site-packages\sphinxbase\ad.py", line 34, in swig_import_helper
    return importlib.import_module('_ad')
  File "C:\Python27\lib\importlib\__init__.py", line 37, in import_module
    __import__(name)
ImportError: No module named _ad

Upvotes: 1

Views: 1315

Answers (2)

Nikolay Shmyrev
Nikolay Shmyrev

Reputation: 25220

This is a bug tracked at repo

https://github.com/bambocher/pocketsphinx-python/issues/19

To fix it you have to rebuild the module or ask maintainer to upload proper version.

You can also use pocketsphinx official API and pyaudio, it will work fine without ad.

Upvotes: 0

Anthon
Anthon

Reputation: 76672

sphinxbase has C based component compiled into a file named _ad.so, that is what seems to be missing on your system.

You should try to reinstall that module and make sure there are no install warnings that might indicate the compilation did not work out.

Upvotes: 1

Related Questions