I'm actually trying to import a package in the python shell but I get a shared object error
>>> from vosk import aligner
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/ec2-user/voice_recog/vosk-api/python/vosk/__init__.py", line 21, in <module>
_c = open_dll()
File "/home/ec2-user/voice_recog/vosk-api/python/vosk/__init__.py", line 15, in open_dll
return _ffi.dlopen(os.path.join(dlldir, "libvosk.so"))
OSError: cannot load library '/home/ec2-user/voice_recog/vosk-api/python/vosk/libvosk.so': /home/ec2-user/voice_recog/vosk-api/python/vosk/libvosk.so: cannot open shared object file: No such file or directory
Also the init.py file has these lines
def open_dll():
dlldir = os.path.abspath(os.path.dirname(__file__))
if sys.platform == 'win32':
# We want to load dependencies too
os.environ["PATH"] = dlldir + os.pathsep + os.environ['PATH']
if hasattr(os, 'add_dll_directory'):
os.add_dll_directory(dlldir)
return _ffi.dlopen(os.path.join(dlldir, "libvosk.dll"))
elif sys.platform == 'linux':
return _ffi.dlopen(os.path.join(dlldir, "libvosk.so"))
elif sys.platform == 'darwin':
return _ffi.dlopen(os.path.join(dlldir, "libvosk.dyld"))
else:
raise TypeError("Unsupported platform")
_c = open_dll()
This is the directory I'm working on root directory
And this is the directory of the vosk package
The link file depending upon the OS has to be downloaded from https://github.com/alphacep/vosk-api/releases and has to be placed in the respective directory where the error occurs.