Create standalone executables from Python scripts, with the same performance and is cross-platform.

Overview

About 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.

It supports Python 3.6 up to 3.9.

If you need support for older Python check the documentation.

Highlights of Version 6.2 up to 6.5:

  • Improved ModuleFinder, using importlib.machinery
  • Support for package metadata
  • Enhanced support for Python 3.8 and experimental support for Python 3.9
  • Better support for MSYS2 and Anaconda (simultaneously launching the version)
  • Improvements for multiprocessing
  • Integrated to setuptools and importlib.metadata
  • Code modernization
  • Various bug fixes.

Installation

In a virtual environment, install by issuing the command:

pip install cx_Freeze --upgrade

For other options, check the documentation.

Documentation

The official documentation is available here.

If you need help you can also ask on the discussion channel: https://github.com/marcelotduarte/cx_Freeze/discussions

License

cx_Freeze uses a license derived from the Python Software Foundation License. You can read the cx_Freeze license in the documentation or in the source repository.

Comments
  • script frozen with pyenv python : sys.version shows system python version??

    script frozen with pyenv python : sys.version shows system python version??

    pyenv installed python 3.8.4 , cx-freeze 6.2

    hi there, if i freeze even a basic script using a pyenv installed version of python, when the script runs it reports sys.version of the system python... why??

    cxfreeze if definitely being run from the pyenv installed python 3.8.4, on my system the system (non-pyenv) python version is 3.8.2, when i run the frozen script, sys.version reports 3.8.2 (system python) not 3.8.4 (the pyenv installed version of python the script is frozen with).

    trivial example script:

    import sys

    print('sys.version', sys.version) print('sys.version_info', sys.version_info)

    opened by elguavas 72
  • No module named __startup__

    No module named __startup__

    Originally reported by: Anonymous


    When trying to run the created executable an import error occurs. ImportError: No module named startup

    Have also tried to run the samples from the source folder without success

    Running on Mint17.3, Python 2.7, cx_Freeze 5


    • Bitbucket: https://bitbucket.org/anthony_tuininga/cx_freeze/issue/209
    bug major 
    opened by anthony-tuininga 55
  • How to write setup.py including own python module and HTML CSS files?

    How to write setup.py including own python module and HTML CSS files?

    Sorry I should post to discussions. I tried to delete this issues but I can't do it. I made desktop app with Python. It has GUI using eel library. So Gui made by HTML and CSS. Also It's not only one file

    app.py imports own module like this.

    app.py-module      |-YT_Download.py      |-lyrics.py      |-meta_song.py

    I want to build up for windows and mac.

    I couldn't find the sample like this complicated.

    So I don't know how to write setup.py for kind of this situation.

    please someone help me.

    My first desktop app YT-download

    question 
    opened by wimpykid719 51
  • cx_Freeze fails to install in platforms not supported by patchelf-pypi

    cx_Freeze fails to install in platforms not supported by patchelf-pypi

    Help me:

      -- Trying "Ninja" generator
      --------------------------------
      ---------------------------
      ----------------------
      -----------------
      ------------
      -------
      --
      Not searching for unused variables given on the command line.
      CMake Error: CMake was unable to find a build program corresponding to "Ninja".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
      -- Configuring incomplete, errors occurred!
      See also "/data/data/com.termux/files/usr/tmp/pip-install-bedqnhtz/patchelf_3243bbffba8f4fd787e8ce6140e21522/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
      --
      -------
      ------------
      -----------------
      ----------------------
      ---------------------------
      --------------------------------
      -- Trying "Ninja" generator - failure
      --------------------------------------------------------------------------------
    
    
    
      --------------------------------------------------------------------------------
      -- Trying "Unix Makefiles" generator
      --------------------------------
      ---------------------------
      ----------------------
      -----------------
      ------------
      -------
      --
      Not searching for unused variables given on the command line.
      -- The C compiler identification is Clang 15.0.6
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Check for working C compiler: /data/data/com.termux/files/usr/bin/cc - skipped
      -- Detecting C compile features
      -- Detecting C compile features - done
      -- The CXX compiler identification is Clang 15.0.6
      -- Detecting CXX compiler ABI info
      -- Detecting CXX compiler ABI info - done
      -- Check for working CXX compiler: /data/data/com.termux/files/usr/bin/c++ - skipped
      -- Detecting CXX compile features
      -- Detecting CXX compile features - done
      -- Configuring done
      -- Generating done
      -- Build files have been written to: /data/data/com.termux/files/usr/tmp/pip-install-bedqnhtz/patchelf_3243bbffba8f4fd787e8ce6140e21522/_cmake_test_compile/build
      --
      -------
      ------------
      -----------------
      ----------------------
      ---------------------------
      --------------------------------
      -- Trying "Unix Makefiles" generator - success
      --------------------------------------------------------------------------------
    
      Configuring Project
        Working directory:
          /data/data/com.termux/files/usr/tmp/pip-install-bedqnhtz/patchelf_3243bbffba8f4fd787e8ce6140e21522/_skbuild/linux-armv7l-3.11/cmake-build
        Command:
          cmake /data/data/com.termux/files/usr/tmp/pip-install-bedqnhtz/patchelf_3243bbffba8f4fd787e8ce6140e21522 -G 'Unix Makefiles' -DCMAKE_INSTALL_PREFIX:PATH=/data/data/com.termux/files/usr/tmp/pip-install-bedqnhtz/patchelf_3243bbffba8f4fd787e8ce6140e21522/_skbuild/linux-armv7l-3.11/cmake-install -DPYTHON_VERSION_STRING:STRING=3.11.1 -DSKBUILD:INTERNAL=TRUE -DCMAKE_MODULE_PATH:PATH=/data/data/com.termux/files/usr/tmp/pip-build-env-frruy6lx/overlay/lib/python3.11/site-packages/skbuild/resources/cmake -DPYTHON_EXECUTABLE:PATH=/data/data/com.termux/files/home/.local/share/virtualenvs/test-GelrdIJB/bin/python -DPYTHON_INCLUDE_DIR:PATH=/data/data/com.termux/files/usr/include/python3.11 -DPYTHON_LIBRARY:PATH=/data/data/com.termux/files/usr/lib/libpython3.11.so -DPython_EXECUTABLE:PATH=/data/data/com.termux/files/home/.local/share/virtualenvs/test-GelrdIJB/bin/python -DPython_ROOT_DIR:PATH=/data/data/com.termux/files/home/.local/share/virtualenvs/test-GelrdIJB -DPython_INCLUDE_DIR:PATH=/data/data/com.termux/files/usr/include/python3.11 -DPython_FIND_REGISTRY:STRING=NEVER -DPython3_EXECUTABLE:PATH=/data/data/com.termux/files/home/.local/share/virtualenvs/test-GelrdIJB/bin/python -DPython3_ROOT_DIR:PATH=/data/data/com.termux/files/home/.local/share/virtualenvs/test-GelrdIJB -DPython3_INCLUDE_DIR:PATH=/data/data/com.termux/files/usr/include/python3.11 -DPython3_FIND_REGISTRY:STRING=NEVER -DCMAKE_BUILD_TYPE:STRING=Release
    
      -- The C compiler identification is Clang 15.0.6
      -- The CXX compiler identification is Clang 15.0.6
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Check for working C compiler: /data/data/com.termux/files/usr/bin/cc - skipped
      -- Detecting C compile features
      -- Detecting C compile features - done
      -- Detecting CXX compiler ABI info
      -- Detecting CXX compiler ABI info - done
      -- Check for working CXX compiler: /data/data/com.termux/files/usr/bin/c++ - skipped
      -- Detecting CXX compile features
      -- Detecting CXX compile features - done
      -- Configuring done
      -- Generating done
      CMake Warning:
        Manually-specified variables were not used by the project:
    
          PYTHON_EXECUTABLE
          PYTHON_INCLUDE_DIR
          PYTHON_LIBRARY
          PYTHON_VERSION_STRING
          Python3_EXECUTABLE
          Python3_FIND_REGISTRY
          Python3_INCLUDE_DIR
          Python3_ROOT_DIR
          Python_EXECUTABLE
          Python_FIND_REGISTRY
          Python_INCLUDE_DIR
          Python_ROOT_DIR
          SKBUILD
    
    
      -- Build files have been written to: /data/data/com.termux/files/usr/tmp/pip-install-bedqnhtz/patchelf_3243bbffba8f4fd787e8ce6140e21522/_skbuild/linux-armv7l-3.11/cmake-build
      [ 12%] Creating directories for 'build_patchelf'
      [ 25%] No download step for 'build_patchelf'
      [ 37%] No update step for 'build_patchelf'
      [ 50%] Performing patch step for 'build_patchelf'
      ./bootstrap.sh: 2: autoreconf: not found
      make[2]: *** [CMakeFiles/build_patchelf.dir/build.make:113: build_patchelf-prefix/src/build_patchelf-stamp/build_patchelf-patch] Error 127
      make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/build_patchelf.dir/all] Error 2
      make: *** [Makefile:136: all] Error 2
      Traceback (most recent call last):
        File "/data/data/com.termux/files/usr/tmp/pip-build-env-frruy6lx/overlay/lib/python3.11/site-packages/skbuild/setuptools_wrap.py", line 640, in setup
          cmkr.make(make_args, install_target=cmake_install_target, env=env)
        File "/data/data/com.termux/files/usr/tmp/pip-build-env-frruy6lx/overlay/lib/python3.11/site-packages/skbuild/cmaker.py", line 684, in make
          self.make_impl(clargs=clargs, config=config, source_dir=source_dir, install_target=install_target, env=env)
        File "/data/data/com.termux/files/usr/tmp/pip-build-env-frruy6lx/overlay/lib/python3.11/site-packages/skbuild/cmaker.py", line 715, in make_impl
          raise SKBuildError(
    
      An error occurred while building with CMake.
        Command:
          cmake --build . --target install --config Release --
        Install target:
          install
        Source directory:
          /data/data/com.termux/files/usr/tmp/pip-install-bedqnhtz/patchelf_3243bbffba8f4fd787e8ce6140e21522
        Working directory:
          /data/data/com.termux/files/usr/tmp/pip-install-bedqnhtz/patchelf_3243bbffba8f4fd787e8ce6140e21522/_skbuild/linux-armv7l-3.11/cmake-build
      Please check the install target is valid and see CMake's output for more information.
      [end of output]
    

    note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for patchelf Successfully built cx-freeze Failed to build patchelf ERROR: Could not build wheels for patchelf, which is required to install pyproject.toml-based projects

    opened by Dendi777 39
  • Intel MKL FATAL ERROR: Cannot load mkl_intel_thread.dll

    Intel MKL FATAL ERROR: Cannot load mkl_intel_thread.dll

    Reopening https://github.com/marcelotduarte/cx_Freeze/issues/355 : issue re-appeared with cx_Freeze 6.1 and is still there with 6.2.

    The executable built with cx_Freeze fails to launch, without showing any error message when started with double-click or from a Windows cmd prompt. When started from a Git Bash shell, the following error message is displayed:

    INTEL MKL ERROR: The specified module could not be found. mkl_intel_thread.dll. Intel MKL FATAL ERROR: Cannot load mkl_intel_thread.dll.

    Configuration:

    • Windows 10
    • Python 3.8.5 installed from https://www.python.org/
    • numpy 1.19.1+mkl installed with pip using wheel from https://www.lfd.uci.edu/~gohlke/pythonlibs/
    • various python modules installed using pip

    A same/similar issue is also observed with Python 3.6.8 or earlier versions of numpy such as e.g. 1.18.4+mkl or 1.19.0+mkl.

    I've observed that cx_Freeze includes 3 DLLs mkl_rt.dll, python38.dll, and vcruntime140.dll in the subdirectory lib\numpy\core of the build directory, whereas the original installation does not contain any DLL in the subdirectory site-packages\numpy\core (all DLLs are in site-packages\numpy\DLLs). If I manually remove mkl_rt.dll from the subdirectory lib\numpy\core of the build directory after building the application with cx_Freeze, the issue disappears and the application works.

    opened by jpeg13 34
  • Import errors when using cx_Freeze with specific scipy modules

    Import errors when using cx_Freeze with specific scipy modules

    Originally reported by: azylstra (Bitbucket: azylstra, GitHub: azylstra)


    Following up on StackOverflow issue

    My project uses scipy in a few places and after freezing I would get a variety of import errors. Those seemed to be naming issues (see in the StackOverflow link, the executable was looking for _csr when scipy.sparse.sparsetools._csr was what was packaged).

    Unfortunately the project cannot be public but I tried to replicate the issue in an example. The _csr problem appears to be coming from a piece of code that uses import scipy.optimize. Other modules when imported specifically cause other errors. For example, here is some logged console output from an executable:

    10/27/13 9:58:08.856 AM Python[8116]: Start cx_Freeze test
    10/27/13 9:58:08.959 AM Python[8116]: Imported scipy OK
    10/27/13 9:58:08.961 AM Python[8116]: Uh oh, failed to import scipy.interpolate: No module named 'scipy.special._ufuncs_cxx'
    10/27/13 9:58:08.962 AM Python[8116]: Uh oh, failed to import scipy.integrate: No module named 'scipy.special._ufuncs_cxx'
    10/27/13 9:58:09.020 AM Python[8116]: Uh oh, failed to import scipy.optimize: No module named '_csr'
    10/27/13 9:58:09.023 AM Python[8116]: Uh oh, failed to import scipy.stats: No module named 'scipy.special._ufuncs_cxx'
    10/27/13 9:58:09.023 AM Python[8116]: cx_Freeze test completed
    

    I've attached a zip of the setup.py and python code used to generate that output, along with a text file containing the console output of the build, and the entire build folder.

    Here are the details of my system:

    • OS X 10.9
    • python 3.3.2
    • cx_Freeze 4.3.2
    • scipy 0.13.0

    • Bitbucket: https://bitbucket.org/anthony_tuininga/cx_freeze/issue/43
    bug major 
    opened by anthony-tuininga 34
  • EXE exits without error shown but works from command line

    EXE exits without error shown but works from command line

    I am through the looking glass here.

    I am running cx_freeze on the following system:

    • OS: Windows 10
    • System type: 64-bit, x64-based processor
    • Python ver: 3.7
    • conda ver: 4.8.3
    • cx_freeze 6.1 conda-forge

    I've included the main modules used for this program.

    • matplotlib: 3.2.2 0
    • numpy: 1.18.5 py37h6530119_0
    • pandas: 1.0.5 py37h47e9c7a_0
    • scipy: 1.5.0 py37h9439919_0

    First build had initial problem discussed in #355 and #199 , including the proper DLLs.

    INTEL MKL ERROR: The specified module could not be found. mkl_intel_thread.dll.
    Intel MKL FATAL ERROR: Cannot load mkl_intel_thread.dll.
    

    I corrected by copying libiomp5md.dll, mkl_intel_thread.dll, and mkl_sequential.dll into the build folder.

    Next, I get a scipy error, similar to past issues, #43 , #233 , and others, regarding the scipy modules.

    ...lib\site-packages\scipy\ndimage\filters.py", line 36, in <module>
        from . import _ni_support
    ImportError: cannot import name '_ni_support' from 'scipy.ndimage' 
    

    I solved this, not by specifying scipy in the includes exe setup options, but rather in the "include_files" option as (scipy_path, "scipy"), where scipy_path is the location of the site-packages\scipy folder for the specific envs path (conda environment) I am building the .exe in. I am not certain why I can't specify the particular modules used in includes, as I have done this for matplotlib.pyplot.

    My program will execute now as expected, but only from the conda powershell/command line. When attempting to click on the .exe file, nothing happens.

    Attempting a solution, I placed the base="Win32GUI" in the Executable, as per here, but to no avail. Thoughts?

    patch available success 
    opened by double0darbo 33
  • Python 3.4 venv importlib AttributeError

    Python 3.4 venv importlib AttributeError

    Originally reported by: Anonymous


    The build works find, but there is an issue with importlib_bootstrap.py when running the application.

    import inspect File "c:\python\32-bit\3.4\lib\importlib_bootstrap.py", line 2214, in _find_and_load File "c:\python\32-bit\3.4\lib\importlib_bootstrap.py", line 2203, in _find_and_load_unlocked File "c:\python\32-bit\3.4\lib\importlib_bootstrap.py", line 1191, in _load_unlocked File "c:\python\32-bit\3.4\lib\importlib_bootstrap.py", line 1161, in _load_backward_compatible AttributeError: 'module' object has no attribute '_fix_up_module'

    Python 3.4.1 cx_Freeze 4.3.3 I am also using a venv virtual environment.


    • Bitbucket: https://bitbucket.org/anthony_tuininga/cx_freeze/issue/81
    bug major 
    opened by anthony-tuininga 33
  • Wrong output for

    Wrong output for "Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding"

    Using Arch Linux with latest cx_freeze version from AUR.

    I've noticed the bug "Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding" has been reported against several versions of cx_freeze and has been fixed in several others: Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding Python runtime state: core initialized ModuleNotFoundError: No module named 'encodings'

    IMHO, there's more to fix than just that bug: The error is reported as "ModuleNotFoundError" - but the problem seems to be the directory: either it isn't found, or some encoding has been detected, which isn't found in the directory.

    So, it would be easier to find the cause for the bug, if the following data would be provided:

    1. Which encoding has been detected?
    2. Where did cx_freeze look for the encoding?

    I'd guess, this would also be of interest for You, when people are asking for help with the encoding problem.

    opened by pnabbefeld 29
  • Mac Big Sur Tkinter Black Screen

    Mac Big Sur Tkinter Black Screen

    Current python (3.9.1) cx-Freeze (6.4.2) on samples/Tkinter (as well as other tkinter applications) causes a completely black Tk window on MacOS Big Sur (11.1). (Works fine when running from source.)

    This is a blocker, any thoughts on a work around? (Compile 3.9 from scratch? Newer tkinter?)

    (Also note that one must now "codesign --remove-signature lib/Python" inside the built App.)

    opened by hefischer 29
  • [Help] Unable to deploy python program due to cv2

    [Help] Unable to deploy python program due to cv2

    Ubuntu 18.04 aarch64 cx-Freeze 6.11.1 python 3.6.9

    my setup.py:

    import sys
    import os
    import cv2
    
    from cx_Freeze import Executable, setup
    
    opencv_lib_src = os.path.join(os.path.dirname(cv2.__file__), '..', 'opencv_python.libs')
    opencv_lib_dst = os.path.join('lib', 'opencv_python.libs')
    build_exe_options = {"packages": ["os"],
                         "excludes": ["tkinter"],
                         "include_files": [(opencv_lib_src , opencv_lib_dst)]}
    
    base = None
    if sys.platform == "win32":
        base = "Win32GUI"
    
    setup(
        name="frame",
        version="0.1",
        description="frame1",
        options={"build_exe": build_exe_options},
        executables=[Executable("frame1.py", base=base)],
    )
    

    execute:

    $ ./build/exe.linux-aarch64-3.6/frame1
    

    output:

    QFactoryLoader::QFactoryLoader() checking directory path "/opt/flocCheck/build/exe.linux-aarch64-3.6/lib/cv2/qt/plugins" ...
    QFactoryLoader::QFactoryLoader() checking directory path "/opt/flocCheck/build/exe.linux-aarch64-3.6" ...
    QFactoryLoader::QFactoryLoader() looking at "/opt/flocCheck/build/exe.linux-aarch64-3.6/frame1"
    "Failed to extract plugin meta data from '/opt/flocCheck/build/exe.linux-aarch64-3.6/frame1'"
             not a plugin
    QFactoryLoader::QFactoryLoader() checking directory path "/opt/flocCheck/build/exe.linux-aarch64-3.6/lib/cv2/qt/plugins/platforms" ...
    QFactoryLoader::QFactoryLoader() looking at "/opt/flocCheck/build/exe.linux-aarch64-3.6/lib/cv2/qt/plugins/platforms/libqxcb.so"
    Found metadata in lib /opt/flocCheck/build/exe.linux-aarch64-3.6/lib/cv2/qt/plugins/platforms/libqxcb.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "xcb"
            ]
        },
        "archreq": 0,
        "className": "QXcbIntegrationPlugin",
        "debug": false,
        "version": 331520
    }
    
    Got keys from plugin meta data ("xcb")
    QFactoryLoader::QFactoryLoader() checking directory path "/opt/flocCheck/build/exe.linux-aarch64-3.6/platforms" ...
    Cannot load library /opt/flocCheck/build/exe.linux-aarch64-3.6/lib/cv2/qt/plugins/platforms/libqxcb.so: (libQt5XcbQpa-720a298b.so.5.15.0: cannot open shared object file: No such file or directory)
    QLibraryPrivate::loadPlugin failed on "/opt/flocCheck/build/exe.linux-aarch64-3.6/lib/cv2/qt/plugins/platforms/libqxcb.so" : "Cannot load library /opt/flocCheck/build/exe.linux-aarch64-3.6/lib/cv2/qt/plugins/platforms/libqxcb.so: (libQt5XcbQpa-720a298b.so.5.15.0: cannot open shared object file: No such file or directory)"
    qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/opt/flocCheck/build/exe.linux-aarch64-3.6/lib/cv2/qt/plugins" even though it was found.
    This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
    
    Available platform plugins are: xcb.
    
    Aborted (core dumped)
    

    the libqxcb.so indeed exists, full path is /opt/flocCheck/build/exe.linux-aarch64-3.6/lib/cv2/qt/plugins/platforms/libqxcb.so

    opened by TENX-S 28
  • vcruntime140.dll sometimes missing from top level

    vcruntime140.dll sometimes missing from top level

    Sometimes vcruntime140.dll isn't copied to the top level of our Windows builds even though we pass include_msvcr.

    _post_copy_hook calls _pre_copy_hook (which copies vcruntime to lib/) and then _copy_file with the new target returned from _pre_copy_hook (top level). However, _copy_file itself calls _pre_copy_hook, which changes the target from top level to lib/ again because vcruntime is in runtime_files but no longer in runtime_files_to_dup.

    So I think we get a top level vcruntime140.dll when _freeze_executable finds it directly and passes it to _copy_top_dependency, but not when it's found as a dependency of another DLL (e.g. vcruntime140_1.dll) and _post_copy_hook tries to copy it.

    I think it'd be difficult to reliably reproduce this, but if my explanation doesn't make sense and you need an example, let me know.

    Windows (64 bit) cx_Freeze 6.13.1 Python 3.10.9

    opened by stevenbronson-wk 0
  • FileNotFoundError when try to freeze project with albumentations and scikit-learn modules

    FileNotFoundError when try to freeze project with albumentations and scikit-learn modules

    Describe the bug An error occurs after freezing:

    FileNotFoundError: Could not find module 'C:\Projects\python_projects\cx_freeze_issues\sklearn_libs\out\lib\sklearn\.libs\vcomp140.dll' (or one of its dependencies). Try using the full path with constructor syntax.
    

    To Reproduce project.py:

    import albumentations as A
    print(A.__version__)
    

    requirements.txt:

    cx-Freeze
    albumentations==1.2.0
    qudida==0.0.4
    scikit-learn==1.1.1
    scipy==1.8.1
    

    Freezer script:

    set WORKSPACE=%~dp0
    set FREEZER_EXE_PATH="%WORKSPACE%\venv\Scripts\cxfreeze.exe"
    set TARGET_DIR=out
    set TARGET_NAME=project_out.exe
    set PACKAGES=albumentations,qudida,scipy,sklearn
    set PROJECT_SOURCE_PY_PATH=project.py
    
    %FREEZER_EXE_PATH% -O -OO --target-dir=%TARGET_DIR% --target-name=%TARGET_NAME% --packages=%PACKAGES% %PROJECT_SOURCE_PY_PATH%
    

    Output of frozen project's exe:

    PS C:\Projects\python_projects\cx_freeze_issues\sklearn_libs\out> .\project_out.exe
    Traceback (most recent call last):
      File "C:\Projects\python_projects\cx_freeze_issues\sklearn_libs\venv\Lib\site-packages\cx_Freeze\initscripts\__startup__.py", line 138, in run
        module_init.run(name + "__main__")
      File "C:\Projects\python_projects\cx_freeze_issues\sklearn_libs\venv\Lib\site-packages\cx_Freeze\initscripts\console.py", line 16, in run
        exec(code, module_main.__dict__)  # pylint: disable=exec-used
      File "project.py", line 1, in <module>
      File "C:\Projects\python_projects\cx_freeze_issues\sklearn_libs\venv\lib\site-packages\albumentations\__init__.py", line 5, in <module>
        from .augmentations import *
      File "C:\Projects\python_projects\cx_freeze_issues\sklearn_libs\venv\lib\site-packages\albumentations\augmentations\__init__.py", line 7, in <module>
        from .domain_adaptation import *
      File "C:\Projects\python_projects\cx_freeze_issues\sklearn_libs\venv\lib\site-packages\albumentations\augmentations\domain_adaptation.py", line 6, in <module>
        from qudida import DomainAdapter
      File "C:\Projects\python_projects\cx_freeze_issues\sklearn_libs\venv\lib\site-packages\qudida\__init__.py", line 6, in <module>
        from sklearn.decomposition import PCA
      File "C:\Projects\python_projects\cx_freeze_issues\sklearn_libs\venv\lib\site-packages\sklearn\__init__.py", line 80, in <module>
        from . import _distributor_init  # noqa: F401
      File "C:\Projects\python_projects\cx_freeze_issues\sklearn_libs\venv\lib\site-packages\sklearn\_distributor_init.py", line 23, in <module>
        WinDLL(op.abspath(vcomp140_dll_filename))
      File "C:\Program Files\Python39\lib\ctypes\__init__.py", line 374, in __init__
        self._handle = _dlopen(self._name, mode)
    FileNotFoundError: Could not find module 'C:\Projects\python_projects\cx_freeze_issues\sklearn_libs\out\lib\sklearn\.libs\vcomp140.dll' (or one of its dependencies). Try using the full path with constructor syntax.
    PS C:\Projects\python_projects\cx_freeze_issues\sklearn_libs\out>
    

    Desktop (please complete the following information):

    • Platform information: Windows 10
    • OS architecture (e.g. amd64): 64bit
    • cx_Freeze version [e.g. 6.11]: 6.13.1
    • Python version [e.g. 3.10]: 3.9.13

    Additional context Add any other context about the problem here.

    duplicate 
    opened by bw7715 4
  • After freezing missing libtcl8.6.dylib, libtk8.6.dylib and SSL error

    After freezing missing libtcl8.6.dylib, libtk8.6.dylib and SSL error

    Describe the bug Hello everyone,

    First here is my setup.py:

    import os
    import sys
    import certifi
    from cx_Freeze import setup, Executable
    
    
    PYTHON_INSTALL_DIR = os.path.dirname(os.path.dirname(os.__file__))
    
    # Adding files
    build_exe_options = {
        "include_files": [
            "resources",
            (certifi.where(), 'cacert.pem'),
            os.path.join(PYTHON_INSTALL_DIR, 'libtcl8.6.dylib'),
            os.path.join(PYTHON_INSTALL_DIR, 'libtk8.6.dylib')
        ],
        "includes": ["tkinter"],
    }
    
    os.environ["REQUESTS_CA_BUNDLE"] = os.path.join(os.getcwd(), "cacert.pem")
    os.environ['TCL_LIBRARY'] = os.path.join(os.getcwd(), 'libtcl8.6.dylib')
    os.environ['TK_LIBRARY'] = os.path.join(os.getcwd(), 'libtk8.6.dylib')
    
    
    base = None
    if sys.platform == "win32":
        base = "Win32GUI"
    
    # Targets
    mac = Executable(
        "affy.py",
        base=base,
        icon="logo-affy.ico",
        target_name="Affybot",
    )
    
    setup(
        name="Affybot",
        version="1.0",
        description="Description",
        author="David Perlusz",
        options={
            "build_exe": build_exe_options
        },
        executables=[mac],
    )
    
    

    I would like to freeze a tkinter gui application. After when the build is success I encountered a strange problem. When I start the application from the build/Affybot.app the app starts, but not working properly.

    When I wanted to check what is the problem and see a bit more I tried to start the app from the build/exe.macosx-10.9-x86_64-3.9/Affybot in console and I got the following error:

    Traceback (most recent call last): File "/Users/davidperlusz/code/affy/.venv/lib/python3.9/site-packages/cx_Freeze/initscripts/__startup__.py", line 138, in run module_init.run(name + "__main__") File "/Users/davidperlusz/code/affy/.venv/lib/python3.9/site-packages/cx_Freeze/initscripts/console.py", line 16, in run exec(code, module_main.__dict__) # pylint: disable=exec-used File "affy.py", line 3, in <module> File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/tkinter/__init__.py", line 37, in <module> import _tkinter # If this fails your Python may not be configured for Tk ImportError: dlopen(/Users/davidperlusz/code/affy/build/exe.macosx-10.9-x86_64-3.9/lib/_tkinter.cpython-39-darwin.so, 0x0002): Library not loaded: @loader_path/../lib/libtcl8.6.dylib Referenced from: <94CE77B6-5CAD-3C3A-AC13-34A8B8F01541> /Users/davidperlusz/code/affy/build/exe.macosx-10.9-x86_64-3.9/lib/_tkinter.cpython-39-darwin.so Reason: tried: '/Users/davidperlusz/code/affy/build/exe.macosx-10.9-x86_64-3.9/lib/../lib/libtcl8.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/[email protected]_path/../lib/libtcl8.6.dylib' (no such file), '/Users/davidperlusz/code/affy/build/exe.macosx-10.9-x86_64-3.9/lib/../lib/libtcl8.6.dylib' (no such file), '/usr/local/lib/libtcl8.6.dylib' (no such file), '/usr/lib/libtcl8.6.dylib' (no such file, not in dyld cache)

    I found these missing files in the exe.macosx-10.9-x86_64-3.9 folder and I copied them to usr/local/lib manually. This solved the above error, but I'm prety sure this is not the good working way.

    Also it isn't solved all of my problems. The app now starts but when I try to make a request from it I got an other error:

    Can't connect to HTTPS URL because the SSL module is not available.

    Please can you help me with this? Thank you so much

    opened by Wathfea 0
  • Freezing scikit-learn

    Freezing scikit-learn

    Originally posted by jhoekx December 14, 2022 We were trying to use cx_Freeze to generate a Windows .exe that includes the sklearn module. Quite a few workaround were needed.

    (venv) PS > pip freeze
    cx-Freeze==6.13.1
    joblib==1.2.0
    lief==0.12.3
    numpy==1.23.5
    packaging==22.0
    scikit-learn==1.2.0
    scipy==1.9.3
    threadpoolctl==3.1.0
    

    example.py:

    import sklearn
    
    
    def run():
        print("OK")
    
    
    if __name__ == "__main__":
        run()
    

    setup.py:

    from cx_Freeze import Executable, setup
    
    setup(
        name="example",
        version="0.1",
        description="sklearn",
        executables=[Executable("example.py")],
        options={
            "build_exe": {
                "include_msvcr": True,
            },
        }
    )
    

    Running this fails with:

      File "C:\Users\<>\source\freeze-sklearn\venv\lib\site-packages\sklearn\__init__.py", line 80, in <module>
        from . import _distributor_init  # noqa: F401
      File "C:\Users\<>\source\freeze-sklearn\venv\lib\site-packages\sklearn\_distributor_init.py", line 21, in <module>
        WinDLL(op.abspath(vcomp140_dll_filename))
      File "C:\Users\<>\AppData\Local\Programs\Python\Python310\lib\ctypes\__init__.py", line 374, in __init__
        self._handle = _dlopen(self._name, mode)
    FileNotFoundError: Could not find module 'C:\Users\<>\source\freeze-sklearn\build\exe.win-amd64-3.10\lib\sklearn\.libs\vcomp140.dll' (or one of its dependencies). Try using the full path with constructor syntax.
    

    This happens because the failing module sklearn._distributor_init contains:

    import os
    import os.path as op
    from ctypes import WinDLL
    
    
    if os.name == "nt":
        libs_path = op.join(op.dirname(__file__), ".libs")
        vcomp140_dll_filename = op.join(libs_path, "vcomp140.dll")
        msvcp140_dll_filename = op.join(libs_path, "msvcp140.dll")
        WinDLL(op.abspath(vcomp140_dll_filename))
        WinDLL(op.abspath(msvcp140_dll_filename))
    

    These files are not included by cx_Freeze.

    Forcing them in include_files does not work either, because they are in the C runtime files and are as such not copied.

    The workaround we used was to monkey patch the offending module out of existence:

    import sys
    import types
    
    sys.modules["sklearn._distributor_init"] = types.ModuleType("mock")
    

    That is not sufficient to make the example work though. This fixes the exception above, but sklearn includes scipy, which has two problems: 2 packages should be included and we need to copy over another DLL.

    The final working example.py is:

    
    import sys
    import types
    
    sys.modules["sklearn._distributor_init"] = types.ModuleType("mock")
    
    import sklearn
    
    
    def run():
        print("OK")
    
    
    if __name__ == "__main__":
        run()
    

    And setup.py:

    from cx_Freeze import Executable, setup
    
    setup(
        name="example",
        version="0.1",
        description="sklearn",
        executables=[Executable("example.py")],
        options={
            "build_exe": {
                "include_msvcr": True,
                "packages": [
                    "scipy.optimize",
                    "scipy.integrate",
                ],
                "include_files": [
                    ('venv/Lib/site-packages/scipy.libs', 'lib/scipy.libs'),
                ],
            },
        }
    )
    

    Would you consider any of these worthy of opening an issue for? Or is there a better solution?

    patch available success 
    opened by marcelotduarte 3
  • Wrong CUDA version during freezing project with PyTorch

    Wrong CUDA version during freezing project with PyTorch

    Describe the bug I'm trying freeze project with PyTorch 1.11 + CUDA 11.3

    But during freezing the project CUDA DLLs are copied from C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\* instead of ...\venv\lib\site-packages\torch\lib\*

    Desktop (please complete the following information):

    • Platform information: Windows 10
    • cx_Freeze version: 6.13.1
    • Python version: 3.9
    • PyTorch: 1.11.0+cu113

    Part of the cx-freeze output:

    creating directory D:\Work\_build\_output_freezer\lib\torch\jit
    creating directory D:\Work\_build\_output_freezer\lib\torch\jit\mobile
    creating directory D:\Work\_build\_output_freezer\lib\torch\jit\_passes
    creating directory D:\Work\_build\_output_freezer\lib\torch\lib
    copying D:\Work\_build\_venv\lib\site-packages\torch\lib\asmjit.dll -> D:\Work\_build\_output_freezer\lib\torch\lib\asmjit.dll
    copying D:\Work\_build\_venv\lib\site-packages\torch\lib\asmjit.lib -> D:\Work\_build\_output_freezer\lib\torch\lib\asmjit.lib
    copying D:\Work\_build\_venv\lib\site-packages\torch\lib\c10.dll -> D:\Work\_build\_output_freezer\lib\torch\lib\c10.dll
    copying D:\Work\_build\_venv\lib\site-packages\torch\lib\c10.lib -> D:\Work\_build\_output_freezer\lib\torch\lib\c10.lib
    copying D:\Work\_build\_venv\lib\site-packages\torch\lib\c10_cuda.dll -> D:\Work\_build\_output_freezer\lib\torch\lib\c10_cuda.dll
    copying D:\Work\_build\_venv\lib\site-packages\torch\lib\c10_cuda.lib -> D:\Work\_build\_output_freezer\lib\torch\lib\c10_cuda.lib
    copying D:\Work\_build\_venv\lib\site-packages\torch\lib\caffe2_nvrtc.dll -> D:\Work\_build\_output_freezer\lib\torch\lib\caffe2_nvrtc.dll
    copying C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\bin\nvrtc64_112_0.dll -> D:\Work\_build\_output_freezer\lib\torch\lib\nvrtc64_112_0.dll
    copying D:\Work\_build\_venv\lib\site-packages\torch\lib\caffe2_nvrtc.lib -> D:\Work\_build\_output_freezer\lib\torch\lib\caffe2_nvrtc.lib
    copying D:\Work\_build\_venv\lib\site-packages\torch\lib\clog.lib -> D:\Work\_build\_output_freezer\lib\torch\lib\clog.lib
    copying D:\Work\_build\_venv\lib\site-packages\torch\lib\cpuinfo.lib -> D:\Work\_build\_output_freezer\lib\torch\lib\cpuinfo.lib
    copying D:\Work\_build\_venv\lib\site-packages\torch\lib\cublas64_11.dll -> D:\Work\_build\_output_freezer\lib\torch\lib\cublas64_11.dll
    copying C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\bin\cublasLt64_11.dll -> D:\Work\_build\_output_freezer\lib\torch\lib\cublasLt64_11.dll
    copying D:\Work\_build\_venv\lib\site-packages\torch\lib\cudart64_110.dll -> D:\Work\_build\_output_freezer\lib\torch\lib\cudart64_110.dll
    copying D:\Work\_build\_venv\lib\site-packages\torch\lib\cudnn64_8.dll -> D:\Work\_build\_output_freezer\lib\torch\lib\cudnn64_8.dll
    copying D:\Work\_build\_venv\lib\site-packages\torch\lib\cudnn_adv_infer64_8.dll -> D:\Work\_build\_output_freezer\lib\torch\lib\cudnn_adv_infer64_8.dll
    copying C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\bin\cudnn_ops_infer64_8.dll -> D:\Work\_build\_output_freezer\lib\torch\lib\cudnn_ops_infer64_8.dll
    copying D:\Work\_build\_venv\lib\site-packages\torch\lib\cudnn_adv_train64_8.dll -> D:\Work\_build\_output_freezer\lib\torch\lib\cudnn_adv_train64_8.dll
    copying C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\bin\cudnn_ops_train64_8.dll -> D:\Work\_build\_output_freezer\lib\torch\lib\cudnn_ops_train64_8.dll
    copying D:\Work\_build\_venv\lib\site-packages\torch\lib\cudnn_cnn_infer64_8.dll -> D:\Work\_build\_output_freezer\lib\torch\lib\cudnn_cnn_infer64_8.dll
    
    patch available 
    opened by bw7715 11
  • Releases(6.13.1)
    pipx — Install and Run Python Applications in Isolated Environments

    Install and Run Python Applications in Isolated Environments

    Python Packaging Authority 5.9k Jan 07, 2023
    Python Wheel Obfuscator

    pywhlobf obfuscates your wheel distribution by compiling python source file to shared library.

    Hunt Zhan 79 Dec 22, 2022
    tool for creating installers from conda packages

    (conda) Constructor Description Constructor is a tool which allows constructing an installer for a collection of conda packages. It solves needed pack

    Conda 386 Jan 04, 2023
    A tool used to obfuscate python scripts, bind obfuscated scripts to fixed machine or expire obfuscated scripts.

    PyArmor Homepage (中文版网站) Documentation(中文版) PyArmor is a command line tool used to obfuscate python scripts, bind obfuscated scripts to fixed machine

    Dashingsoft 1.9k Jan 01, 2023
    Freeze (package) Python programs into stand-alone executables

    PyInstaller Overview PyInstaller bundles a Python application and all its dependencies into a single package. The user can run the packaged app withou

    PyInstaller 9.9k Jan 08, 2023
    A library which implements low-level functions that relate to packaging and distribution of Python

    What is it? Distlib is a library which implements low-level functions that relate to packaging and distribution of Python software. It is intended to

    Python Packaging Authority 29 Oct 11, 2022
    auto packaging for iOS

    iOS Auto Packaging iOS自动打包脚本 准备 脚本第一次执行之前 先检查依赖, packaging目录下终端执行 pip3 install -r requirements.txt 运行 cd packaging packaging.py -h help -s scheme

    DeeCo 17 Jul 23, 2022
    A distutils extension to create standalone Windows programs from Python code

    py2exe for Python 3 py2exe is a distutils extension which allows to build standalone Windows executable programs (32-bit and 64-bit) from Python scrip

    py2exe 526 Jan 04, 2023
    Ninja is a small build system with a focus on speed.

    Ninja Python Distributions Ninja is a small build system with a focus on speed. The latest Ninja python wheels provide ninja 1.10.2.g51db2.kitware.job

    33 Dec 19, 2022
    shiv is a command line utility for building fully self contained Python zipapps as outlined in PEP 441, but with all their dependencies included.

    shiv shiv is a command line utility for building fully self-contained Python zipapps as outlined in PEP 441, but with all their dependencies included!

    LinkedIn 1.5k Dec 28, 2022
    Nuitka Organization 8k Jan 07, 2023
    An example of repository data as bundles

    Bundles This repository is just an example of how we can host Git bundles in a way that supports fetching data from precomputed bundles without the or

    Derrick Stolee 1 Jan 02, 2022
    Python-easy-pack For Linux/Unix, Changed by laman28

    Python-easy-pack For Linux/Unix, Changed by laman28

    LMFS 2 Jan 28, 2022
    Psgcompiler A PySimpleGUI Application - Transform your Python programs in Windows, Mac, and Linux binary executables

    psgcompiler A PySimpleGUI Application "Compile" your Python programs into an EXE for Windows, an APP for Mac, and a binary for Linux Installation Old-

    PySimpleGUI 77 Jan 07, 2023
    Auto locust load test config and worker distribution with Docker and GitHub Action

    Auto locust load test config and worker distribution with Docker and GitHub Action Install Fork the repo and change the visibility option to private S

    Márk Zsibók 1 Nov 24, 2021
    local pypi server (custom packages and auto-mirroring of pypi)

    localshop A PyPI server which automatically proxies and mirrors PyPI packages based upon packages requested. It has support for multiple indexes and t

    Michael van Tellingen 383 Sep 23, 2022
    Anaconda is the OS installer used by Fedora, RHEL, CentOS and other Linux distributions.

    Anaconda is the OS installer used by Fedora, RHEL, CentOS and other Linux distributions. Documentation Documentation for the Anaconda install

    Red Hat Installer Engineering Team 454 Jan 08, 2023
    WinPython is a portable distribution of the Python programming language for Windows

    WinPython tools Copyright © 2012-2013 Pierre Raybaut Copyright © 2014-2019+ The Winpython development team https://github.com/winpython/ Licensed unde

    1.5k Jan 04, 2023
    Core utilities for Python packages

    packaging Reusable core utilities for various Python Packaging interoperability specifications. This library provides utilities that implement the int

    Python Packaging Authority 451 Jan 04, 2023
    Subpar is a utility for creating self-contained python executables. It is designed to work well with Bazel.

    Subpar Subpar is a utility for creating self-contained python executables. It is designed to work well with Bazel. Status Subpar is currently owned by

    Google 550 Dec 27, 2022