marcelotduarte/cx_Freeze

Could not Find Module vcomp140.dll

themw123 opened this issue · 2 comments

Building the exe with cx_Freeze works fine. When executing the exe i am getting the following error:

...
File "E:\code\myproject\venv\Lib\site-packages\openwakeword_init_.py", line 4, in <module>
from openwakeword.custom_verifier_model import train_custom_verifier
File "E:\code\myproject\venv\Lib\site-packages\openwakeword\custom_verifier_model.py", line 24, in <module>
from sklearn.linear_model import LogisticRegression
File "E:\code\myproject\venv\Lib\site-packages\sklearn_init_.py", line 92, in <module>
from . import (
File "E:\code\myproject/venv/Lib/site-packages/sklearn/distributor_init.py", line 21, in <module>
WinDLL(op.abspath(vcomp140_dll_filename))
File "C:\Users\my_username\AppData\Local\Programs\Python\Python311\Lib\ctypes_init.py", line 376, in init
self._handle = _dlopen(self._name, mode)
^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: Could not find module 'E:\code\myproject\build\exe.win-amd64-3.11\vcomp140.dll' (or one of its dependencies). Try using the full path with constructor syntax.

Even if i add the vcomp140.dll file in build_path/lib/sklearn/.libs/ it still gives me the same error.

Here is my setup.py:

import sys
import os
sys.setrecursionlimit(5000)


if not os.path.exists('temp_audio'):
    os.makedirs('temp_audio')
open('temp_audio/.keep', 'a').close()
    
executables = [Executable("main.py", icon="img/ai.ico", target_name="assisstant")]

options = {
    'build_exe': {
        'packages': ["srsly", "blis", "spacy", "deepspeed", "uvicorn", "sklearn"],
        'include_files': ["example.config.json", "temp_audio", "img", "wakeup.wav"],
        'excludes': [],
    }
}

setup(
    name="Assisstant",
    version="1.0",
    description="assisstant",
    executables=executables,
    options=options
)

Here are my versions of the relates requirements of sklearn(which in turn is used by openwakeword dependency):
numpy==1.26.4
scipy==1.13.1
joblib==1.4.2
threadpoolctl==3.5.0

Desktop (please complete the following information):

  • Platform information (e.g. Ubuntu Linux 22.04):
  • OS architecture (e.g. amd64):
  • cx_Freeze version [e.g. 7.1.1]:
  • Python version [e.g. 3.11.4]:

Please check the FAQ.

wow thanks for the fast reply.

fixed it by adding
'include_msvcr': True

options = {
    'build_exe': {
        'include_msvcr': True,
        'packages': ["srsly", "blis", "spacy", "deepspeed", "uvicorn", "sklearn"],
        'include_files': ["example.config.json", "temp_audio", "img", "wakeup.wav"],
        'excludes': [],
    }
}

In addition: I tried to install both x64 and x86 of Microsoft Visual C++ Redistributable but it did not fixed it.