Distributing DirectPython applications

If you use DirectPython in your application and plan to make it available to others as well, this article might be worth reading. After all, creating stand-alone executables is not necessarily all that simple.

DirectPython dependencies

DirectPython requires these .dll’s to be present in the system. You can redistribute these files, just make sure that they are in the same directory (or can be found by the OS loader). They are located in DirectPython’s installation directory.


DirectPython main runtime. Although it’s extension is .pyd it is actually a dll.


Boost.Python runtime. Version can change between DirectPython releases.


Visual Studio C-runtime. Version can change between DirectPython releases. Note that this might not be the same that Python uses.


Visual Studio C++-runtime. Version can change between DirectPython releases.

There has been a lot of discussion about redistributing msvcXXXX.dll files, the licensing situation was not perfectly clear. To my understanding the licensing issue has been “fixed” and it OK to redistribute these files, but I am not a lawyer.

Additionally two other .dll’s must be found, but you can’t directly redistribute these. They are installed if you run dxsetup.exe which is located in DirectPython’s Redist-folder. This is done automatically when you run DirectPython installer. They are then placed in the Windows system folder.


Direct3D 11 support library. Version can change between DirectPython releases.


Direct3D 11 shader compiler. Version can change between DirectPython releases.

And naturally Direct3D 11 itself must be installed. You can run the D3D11Install.exe from the Redist-folder to see if the system has Direct3D 11 installed.

If some dll’s are missing you will probably get a message like this when attempting to use DirectPython:

Traceback (most recent call last):
  File "SampleGui.py", line 8, in <module>
    import d3d11
ImportError: DLL load failed: The specified module could not be found.

How to distribute

There are several ways you can distribute Python applications and each have their pros and cons. py2exe is a popular choice, altough it does not currently support Python 3.x. cx_Freeze is another alternative and it supports 3.x. If you want to be primitive you can even distribute the whole Python installation with all required modules.

If your users have Python installed you can actually just distribute the four first files (and d3d11x.py plus friends if you use them) mentioned in the previous section - DirectPython itself does not really need to be installed, it is just a bunch of files. You can copy those files and move them to another computer’s Python directory and you just installed DirectPython. No magic there.

The main reason for using an installer is that I can make sure that those two Direct3D 11 files are properly installed. This is important - users don’t want to debug applications to figure out what missing dll’s it requires to run properly. You can write using big red letters in your readme/FAQ/installer that users should run the dxsetup.exe but you can be sure that many never notice it. They just think your application sucks because it does not even start properly.

Also remember that if you use certain d3d11x-objects you should make sure that d3d11x.getResourceDir() returns the right directory.

Table Of Contents

Get DirectPython 11 at SourceForge.net. Fast, secure and Free Open Source software downloads