marcelotduarte / cx_Freeze

cx_Freeze creates standalone executables from Python scripts, with the same performance, is cross-platform and should work on any platform that Python itself works on.
https://marcelotduarte.github.io/cx_Freeze/
Other
1.36k stars 220 forks source link

Could not Find Module vcomp140.dll #2465

Closed themw123 closed 5 months ago

themw123 commented 5 months ago

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):

marcelotduarte commented 5 months ago

Please check the FAQ.

themw123 commented 5 months ago

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.