[vtkusers] python (2.7) problems compiling with MSVC 2010 64bit

Dominik Szczerba dominik at itis.ethz.ch
Wed Jun 8 12:59:54 EDT 2011


I finally got 2.7 to work. Please review, if this is not dirty hacking
I can commit a small wiki page with a HOWTO.

Both python26 and python27 will work if ALL required DLL's will be
copied over to python\bin. Which ones I required can be debugged with
the dependency walker. This includes, e.g., the Qt DLL's, because I
was compiling with Qt GUI support. Probably compiling without Qt, or
appending the missing DLL paths to PATH would work too, but I have not
tested it.

I do not see how executing 'vtkpython' can work in such cases. I found
no documentation about possible setup scenarios and required system
variables.

Best regards,
Dominik

On Wed, Jun 8, 2011 at 5:52 PM, David Gobbi <david.gobbi at gmail.com> wrote:
> I can't speak to why python 2.7 would be different from python 2.6,
> because I have never tried it... hopefully someone else can answer
> that question.
>
>  - David
>
>
> On Wed, Jun 8, 2011 at 7:08 AM, Dominik Szczerba <dominik at itis.ethz.ch> wrote:
>> I have now manually copied everything from vtk's build
>> bin\RelWithDebInfo folder to python's bin folder and I have manually
>> copied Wrapping\Python\vtk to python's lib\site-packages folder.
>> Such treatment seems to work for python 2.6.7 (= "import vtk" works),
>> but does not work for python 2.7.1. Note, I have no python/vtk in the
>> system path and pythonhome and pythonpath are not set.
>>
>> Am I hacking and this will not work the next release, or is the right
>> way to go? Why would 2.7 not work on Windows? Works on linux all
>> right.
>>
>> Thanks for any more hints,
>> Dominik
>>
>>
>> On Wed, Jun 8, 2011 at 12:59 PM, Dominik Szczerba <dominik at itis.ethz.ch> wrote:
>>> Hi David,
>>>
>>> I have tried python 2.6.7 with the same failure. Is this a known issue
>>> for Windows? My configure settings are pretty straight forward: using
>>> shared libs, paths to python/include/lib, enable wrapping, disable TK,
>>> did I forget anything?
>>>
>>> Is there somewhere a comprehensive information what should reside / be
>>> copied where such that I can use vtk with python? I never saw one,
>>> even under http://www.vtk.org/Wiki/VTK/Python_Wrapping_FAQ
>>> I do not (in fact, can not) use vtkpython (that does not work for now
>>> anyway). I need to create a custom python+vtk environment, totally
>>> unregistered with the system (so I can have multiple versions).
>>>
>>> Many thanks and best regards,
>>> Dominik
>>>
>>> On Tue, Jun 7, 2011 at 11:46 PM, David Gobbi <david.gobbi at gmail.com> wrote:
>>>> Hi Dominik,
>>>>
>>>> It might be as simple as cmake not properly detecting python, I know that
>>>> it was unable to detect python-2.7 until very recently, in fact even my
>>>> copy of cmake-2.8.2 is missing the bits that it needs to find python-2.7.
>>>>
>>>> Take a look through your CMakeCache.txt file to make sure that all of the
>>>> python-related variables are set.
>>>>
>>>> Also, now that you know for certain that it is a path-related issue, make
>>>> sure to clear the PYTHONHOME variable or it will get you into trouble
>>>> in the future.
>>>>
>>>>  - David
>>>>
>>>>
>>>> On Tue, Jun 7, 2011 at 3:36 PM, Dominik Szczerba <dominik at itis.ethz.ch> wrote:
>>>>> Hi David,
>>>>>
>>>>> Thanks, indeed, there was no PYTHONHOME set. But setting it brings me
>>>>> only one step further. The next is the error when calling "import
>>>>> vtk". See the error at the end. I saw a similar thread when you wrote
>>>>> it is about mixing release and debug for python. It is not the case
>>>>> here, both python and vtk is self compiled with the same compiler
>>>>> settings (Release). I blind tried various combinations of PATH and
>>>>> PYTHONPATH to no avail. I will be happy about some more ideas to try.
>>>>>
>>>>> Regards,
>>>>> Dominik
>>>>>
>>>>> On Tue, Jun 7, 2011 at 11:26 PM, David Gobbi <david.gobbi at gmail.com> wrote:
>>>>>> Hi Dominik,
>>>>>>
>>>>>> The "site" module is the first to be imported, so if it is missing,
>>>>>> then the "PYTHONHOME" (or equivalent) is not set or is incorrect and
>>>>>> python is unable to find its own modules.
>>>>>>
>>>>>> If you set PYTHONHOME manually (i.e. as an environment variable) to
>>>>>> the directory where python-2.7 resides, then I am guessing that these
>>>>>> tests will pass.
>>>>>>
>>>>>> So... the next question is, why is this happening?  Evidently the
>>>>>> vtkpython executable is missing some critical information that allows
>>>>>> it to find the python-2.7 directory on its own.  The relevant code in
>>>>>> VTK is Wrapping/Python/vtkPythonAppInit.cxx
>>>>>>
>>>>>> None of the dashboard machines seem to use python-2.7.
>>>>>>
>>>>>>  - David
>>>>>>
>>>>>>
>>>>>> On Tue, Jun 7, 2011 at 2:44 PM, Dominik Szczerba <dominik at itis.ethz.ch> wrote:
>>>>>>> Below some output from testing log. I get exactly the same error
>>>>>>> (ImportError: No module named site) by just invoking vtkpython from
>>>>>>> command line.
>>>>>>>
>>>>>>> ----------------------------------------------------------
>>>>>>> 59/251 Testing: PythonSmokePython-image
>>>>>>> 59/251 Test: PythonSmokePython-image
>>>>>>> Command: "E:/build/vtk-5.6.1/bin/Release/vtkpython.exe"
>>>>>>> "E:/pack/vtk-5.6.1/Common/Testing/Python/PythonSmoke.py"
>>>>>>> Directory: E:/build/vtk-5.6.1/Common/Testing/Python
>>>>>>> "PythonSmokePython-image" start time: Jun 07 22:27 W. Europe Daylight Time
>>>>>>> Output:
>>>>>>> ----------------------------------------------------------
>>>>>>> ImportError: No module named site
>>>>>>> <end of output>
>>>>>>> Test time =   2.22 sec
>>>>>>> ----------------------------------------------------------
>>>>>>> Test Failed.
>>>>>>> "PythonSmokePython-image" end time: Jun 07 22:27 W. Europe Daylight Time
>>>>>>> "PythonSmokePython-image" time elapsed: 00:00:02
>>>>>>> ----------------------------------------------------------
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Tue, Jun 7, 2011 at 10:37 PM, Dominik Szczerba <dominik at itis.ethz.ch> wrote:
>>>>>>>> I have compiled python 2.7 in Release mode on MSVC 2010 64bit. I have
>>>>>>>> built vtk-5.6.1 against it (with wrapping enabled). However, I get the
>>>>>>>> below errors when testing the build.
>>>>>>>> My setup is rather standard, I was therefore wondering if there could
>>>>>>>> be something obviously wrong, or 2.7 is simply not yet supported.
>>>>>>>>
>>>>>>>> Regards,
>>>>>>>> Dominik
>>>>>>>>
>>>>>>>> E:\build\vtk-5.6.1>ctest -R Python
>>>>>>>> Test project E:/build/vtk-5.6.1
>>>>>>>>    Start  59: PythonSmokePython-image
>>>>>>>> 1/6 Test  #59: PythonSmokePython-image ......................***Failed    2.22 s
>>>>>>>> ec
>>>>>>>>    Start  60: TestWeakrefPython-image
>>>>>>>> 2/6 Test  #60: TestWeakrefPython-image ......................***Failed    0.09 s
>>>>>>>> ec
>>>>>>>>    Start  61: TestNumpySupportPython-image
>>>>>>>> 3/6 Test  #61: TestNumpySupportPython-image .................***Failed    0.09 s
>>>>>>>> ec
>>>>>>>>    Start  62: TestTerminationCrashPython-image
>>>>>>>> 4/6 Test  #62: TestTerminationCrashPython-image .............***Failed    0.08 s
>>>>>>>> ec
>>>>>>>>    Start  63: TestExecuteMethodFinalizeCrashPython-image
>>>>>>>> 5/6 Test  #63: TestExecuteMethodFinalizeCrashPython-image ...***Failed    0.09 s
>>>>>>>> ec
>>>>>>>>    Start 237: kMeansDistanceCalculatorPython
>>>>>>>> 6/6 Test #237: kMeansDistanceCalculatorPython ...............***Failed    0.08 s
>>>>>>>> ec
>>>>>>>>
>>>>>>>> 0% tests passed, 6 tests failed out of 6
>>>>>>>>
>>>>>>>> Total Test time (real) =   3.50 sec
>>>>>>>>
>>>>>>>> The following tests FAILED:
>>>>>>>>         59 - PythonSmokePython-image (Failed)
>>>>>>>>         60 - TestWeakrefPython-image (Failed)
>>>>>>>>         61 - TestNumpySupportPython-image (Failed)
>>>>>>>>         62 - TestTerminationCrashPython-image (Failed)
>>>>>>>>         63 - TestExecuteMethodFinalizeCrashPython-image (Failed)
>>>>>>>>        237 - kMeansDistanceCalculatorPython (Failed)
>>>>>>>> Errors while running CTest
>>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Powered by www.kitware.com
>>>>>>>
>>>>>>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>>>>>>
>>>>>>> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>>>>>>>
>>>>>>> Follow this link to subscribe/unsubscribe:
>>>>>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>
>>
>
>



More information about the vtkusers mailing list