Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not copy vcruntime140.dll file #278

Closed
Jenyay opened this issue Jun 24, 2017 · 15 comments · Fixed by #640
Closed

Does not copy vcruntime140.dll file #278

Jenyay opened this issue Jun 24, 2017 · 15 comments · Fixed by #640

Comments

@Jenyay
Copy link

Jenyay commented Jun 24, 2017

Hello!

I make simplest script:

# coding: utf-8


if __name__ == '__main__':
    print('Hello world!')

and setup.py:

# coding: utf-8

from cx_Freeze import setup, Executable

executables = [Executable('example.py')]

options = {
    'build_exe': {
        'include_msvcr': True,
    }
}

setup(name='hello_world',
      version='0.0.1',
      description='My Hello World App!',
      executables=executables,
      options=options)

But vcruntime140.dll file was not copied to the build directory.

Python 3.6.1 32 bit
Windows 10
cx_Freeze 5.0.2
virtualenv is not used.

@Jenyay Jenyay changed the title Does not copy file vcruntime140.dll Does not copy vcruntime140.dll file Jun 24, 2017
@henniss
Copy link

henniss commented Oct 4, 2017

Duplicate of #259?

@anthony-tuininga
Copy link
Collaborator

Are you using a virtual environment? See issue #275.

@Jenyay
Copy link
Author

Jenyay commented Nov 5, 2017

No, virtualenv is not used.

@SamiLehtinen
Copy link

SamiLehtinen commented Nov 5, 2017

I've got exactly same issue. I've worked around it using includes parameter, which works well.

@malfario
Copy link

malfario commented Jan 19, 2018

cx_Freeze was working for me as expected until Chocolatey installed Microsoft Visual C++ 2017 Redistributable (x86) 14.11.25325, and suddenly it stopped copying VCRUNTIME140.dll into build\exe.win32-3.6\lib.

Uninstalling the redist package solved the issue for me, tested in these environments:

  • Windows 10, python 3.6.3-x86, cx_Freeze 5.1.1, pipenv 9.0.1
  • Windows 8.1, python 3.6.4-x86, cx_Freeze 5.1.1, pipenv 9.0.1
# setup.py

from cx_Freeze import setup

setup(
    options={
        'build_exe': {
            'include_msvcr': True,
            'replace_paths': [('*', '')],
            'zip_include_packages': ['*'],
            'zip_exclude_packages': [],
        }
    }
)

@jpeg13
Copy link

jpeg13 commented May 25, 2018

I've got exactly the same issue. I can reproduce it using the simple sample (cx_Freeze\samples\simple). The setup.py script runs without error, but when one starts the executable (hello.exe) on a computer without Microsoft Visual C++ 2015 Redistributable package installed, the executable crashes with a system error

The program can't start because VCRUNTIME140.dll is missing from your computer. Try reinstalling to fix this problem.

Python 3.6.5 64 bit
Windows 7
virtualenv is not used.
Tested with cx_Freeze 5.0.2, 5.1.1, and 6.0b1

Adding the build_exe option 'include_msvcr': True does not seem to have any effect with cx_Freeze 5.0.2, 5.1.1, and 6.0b1 (as reported in #259 )

from cx_Freeze import setup, Executable

build_exe_options = {'include_msvcr': True}

executables = [
    Executable('hello.py')
]

setup(name='hello',
      version='0.1',
      description='Sample cx_Freeze script',
      options={'build_exe': build_exe_options},
      executables=executables
      )

Adding VCRUNTIME140.dll manually to the build directory solves the problem (but this is probably what the include_msvcr should do).

Additional remarks:

  • The executable runs without error on a computer with python 3.6 installed and added to the PATH, because VCRUNTIME140.dll is then found in the python 3.6 folder
  • If one imports e.g. matplotlib in the application, VCRUNTIME140.dll is then copied into the build directory by the matplotlib loader/freezer (?); the executable produced with cx_Freeze 5.0.2 or 6.0b1 then works because these versions copy the DLL directly into the build directory; the executable produced with cx_Freeze 5.1.1 does not work because this version copies the DLL into a lib sub-directory (as reported in Microsoft Visual C runtime DLLs are copied to the wrong folder #372 )
  • I have a similar issue with the MSVCP140.dll when using the PySide package (but I haven't yet been able to extract a minimal example, and this second issue might also be related to the fact that PySide does not officially support python 3.6)

@mx2048
Copy link

mx2048 commented Jun 25, 2018

The file VCRUNTIME140.dll is copied into cx_freeze lib dir from your Python os.path.dirname(sys.executable). For some reason you have to copy the file to the root dir manually, so that Windows can find it.

@nezo
Copy link

nezo commented Sep 7, 2018

Hello,

I have noticed as well that simply adding import requests allowed pywintypes36.dll and VCRUNTIME140.dll to get copied during the build.

@gjb1002
Copy link

gjb1002 commented Oct 15, 2019

I have this problem just now (cx_Freeze 6, Python 3.7, Windows 10). The vcruntime140.dll is present in my Python directory, but is not copied, even providing include_msvcr=True. The problem seems to be that the GetDependentFiles method, (which uses the imagehlp library according to a comment) does not detect a dependency between python37.dll and vcruntime140.dll, but then the built exe refuses to run on a machine without vcruntime140.dll. The workarounds above did not help me, though manually copying the DLL into the dist directory after the build is complete does work.

@marcelotduarte
Copy link
Owner

A set of patch of mine resolves this issue. PR #516, #512, #505

@gjb1002
Copy link

gjb1002 commented Oct 15, 2019

OK, great. Hope to see them in a release soon then.

@SamiLehtinen
Copy link

SamiLehtinen commented Oct 15, 2019

With the unpatched version the include parameter works just fine, as I've mentioned about two years ago. include_files = ['path/vcruntime140.dll'] But it's nice to hear that the 'include_msvcr': True should start working soon as well.

@marcelotduarte
Copy link
Owner

cx_Freeze 6.1 has just been released.
Assuming this has been resolved.
If you had issues please re-open.

@AndreiTS
Copy link

AndreiTS commented Jan 9, 2020

I got this error while executing the exe generated by cxfreeze: VCRUNTIME140.dll is missing

I'm using Python 3.8.1, cxFreeze 6.1, my build options are:

build_exe_options = {"packages": ["os","pathlib"], "excludes": ["tkinter"], 'include_msvcr': True}

@tolszak
Copy link

tolszak commented May 21, 2020

Me too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.