[vtkusers] Trouble using cx_freeze

Clément D. clement.douarre at gmail.com
Mon Oct 2 11:35:57 EDT 2017

Hello all,

I'm am using cx_freeze on Windows to create an executable of a Python
Script which includes vtk.
The python script executes fine. Vtk is correctly installed and PYTHONPATH
and PATH variables are set accordingly.

I ran cx_freeze using a setup.py file, which created a build folder with an
executable of the script and the necessary libraries, including the vtk
files necessary for it to run in a "vtk" subfolder. No major problem there.

Double clicking on the .exe file in that folder launchs the program.
Double clicking on the .exe file after temporaly deleting my C:\Python
folder also works.
So at that point I thought my .exe file was indeed "stand alone" and needed
only the subfolders in the build folder (like the vtk one) to work on its

However, when I sent this build folder to a colleague, the execution fails
because of vtk, with message :
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\cx_Freeze\initscripts\__startup_.py",
line 14 in run
File "C:\Python27\lib\site-packages\cx_Freeze\initscripts\Console.pu", line
26, in run
File "PediLoc_Main.py", line 28 in <module>
File "C:\Users\Philippe\Documents\Friz\PediLoc_Result.py", line 109 in
File "C:\Python27\Lib\site-packages\vtk\lib\python2.7\
site-packages\vtk\__init__.py", line 41 in <module>
File "C:\Python27\Lib\site-packages\vtk\lib\python2.7\site-packages\vtk\vtkCommonCore.py",
line 9, in <module>
Import Error : DLL load failed : The specified module could not be found.

In the vtk subfolder of the build, there is vtkCommonCore-8.0.dll.

So I'm sort of stumped here. The .exe works on my computer, even when I
take out Python juste to see if execution is possible without the python
(and therefore, vtk) libraries.
But not on another computer....

Using VTK 8.0.1, Python 2.7, both my computer and my colleague's one are
Windows 7, 64 bits machines.

Thanks for any insight,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20171002/332e01dc/attachment.html>

More information about the vtkusers mailing list