title: Python GTK+ 3 Application Installer and Executable on Windows
body: <p>I recently finished an application using GTK, which I installed on windows with MSYS2 and MINGW64. So far, I have only been able to run the app from the MSYS2 command line; however, I am at the stage where I need to deploy the application (build an installer and executable file).</p>
  
  <p>Here are the routes I have taken from msys2 so far:</p>
  
  <ol>
  <li><p>py2exe from msys2 with the mingw64's python3.6 (with GCC 7.3.0 64 bit). I can build the setup file just fine, but, when I run from msys2 <code>python3 setup.py py2exe</code>, I get the dreaded <code>IndexError: tuple index out of range</code>. After some research, I've learned that I get this because py2exe does not as of yet support python > 3.4</p>
  
  <ol start="2">
  <li>pinstaller: from the msys2 terminal, I cannot even unpack this option. I get this error code <code>distutils.errors.DistutilsPlatformError: VC 6.0 is not supported by this module</code>.</li>
  </ol></li>
  </ol>
  
  <p>Here is a route I have taken out of msys2, in my Windows cmd:</p>
  
  <ol>
  <li>cx_Freeze: Pip could not grab this file from the msys2 terminal, so I moved my project to folders in windows and adjusted my setup.py to find all of the dlls and other necessary files. In terms of actually running and generating an installer exe and application exe, I have had the most success with this option. After running the generated msi file and then running the new executable, though, I get an error like this: <code>from _gi: cannot load the specified dll</code>. After doing some hacky troubleshooting (providing other dlls and reading through the _gi.pyd I provided). Here's what I (believe) I learned. The _gi.pyd specifies python dlls and visual c runtime dlls to include with the import statements import gi catalyzes (<code>import _gi; from . import _.gi; etc.</code>). These specify dlls the msys2 environment of my project uses, so I added them to my setup.py. After doing this, I got an error noting that my app requires a <code>python3.dll</code> that was conflicting with another python dll (the one I tried to provide).</li>
  </ol>
  
  <p>Here is what I think I know, and please, someone, tell me I'm wrong so that I don't have to rebuild my application with pyQt5 (which actually does work without msys2 and mingw64):</p>
  
  <p>I need to figure out a way to provide only the python and c dlls that mingw64 uses (i.e not the python3.dll that the command <code>python setup.py bdist_msi</code> seems to automatically include and unpack from my installer) and bundle those with my application.</p>
  
  <p>OR I need to figure out a way to install a different python 3 (python 3.4) into my mingw64 path in order to use py2exe (which does install in that environment). Even then, though, I would have to figure out how to also give this path an appropriate msvc dll in order for the application to still work.</p>
  
  <p>OR OR I need to rebuild my app.</p>
  
  <p>Has anyone been successful in developing a windows installer and executable with these specs (msys2, mingw64, GTK+ 3, and mingw64's python3.6.5 and GCC 7.3.0 64 bit)? Is there a way to make any of the above-mentioned methods for doing this work in the msys2 terminal? Is there a way to make these work in windows cmd (where I can actually get cx_Freeze and py2exe to work)? Are there any options I'm missing?</p>
  
  <p>Apologies for the long post.</p>