vosk-api icon indicating copy to clipboard operation
vosk-api copied to clipboard

cannot importing libvosk.dll

Open duran004 opened this issue 3 months ago • 6 comments

I can't load the vosk model and it doesn't give me an error. I did some editing to find the error.

def open_dll():
        try:
            dlldir = os.path.abspath(os.path.dirname(__file__))
            if sys.platform == "win32":
                # We want to load dependencies too
                print("importing vosk dll...1")
                os.environ["PATH"] = dlldir + os.pathsep + os.environ["PATH"]
                print("importing vosk dll...2")
                if hasattr(os, "add_dll_directory"):
                    print("importing vosk dll...3")
                    os.add_dll_directory(dlldir)
                    print("importing vosk dll...4")
                    print(os.path.join(dlldir, "libvosk.dll"))
                    e=_ffi.dlopen(os.path.join(dlldir, "libvosk.dll"))
                    print("importing vosk dll...5")
                return e
            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")
        except Exception as e:
            print(f"An error occurred: {e}")

the output is like this

importing vosk dll...1
importing vosk dll...2
importing vosk dll...3
importing vosk dll...4
C:\Users\dcyilmaz\AppData\Local\Programs\Python\Python312\Lib\site-packages\vosk\libvosk.dll

When I check the dll file, it exists in the directory image

duran004 avatar Apr 01 '24 14:04 duran004

You can check with dependencywalker to see what is missing for the dll.

nshmyrev avatar Apr 01 '24 23:04 nshmyrev

You can check with dependencywalker to see what is missing for the dll.

When I try to open libvosk.dll with the library https://github.com/lucasg/Dependencies , I think it says they are missing. I don't quite understand. image

duran004 avatar Apr 02 '24 00:04 duran004

Any ideas?

duran004 avatar Apr 03 '24 12:04 duran004

Those ext ones are expected and not critical. You need to show whole window, not a small part.

nshmyrev avatar Apr 03 '24 13:04 nshmyrev

ofcourse image

image image image image image image

duran004 avatar Apr 03 '24 13:04 duran004

Maybe you have 32-bit python and you installed 64-bit package

nshmyrev avatar Apr 03 '24 16:04 nshmyrev