enthought / mayavi

3D visualization of scientific data in Python
http://docs.enthought.com/mayavi/mayavi/
Other
1.3k stars 285 forks source link

Use “ -DVTK_WHEEL_BUILD=ON -DVTK_WRAP_PYTHON=ON ” will disable the creation for vtkpython. #929

Open hongyi-zhao opened 4 years ago

hongyi-zhao commented 4 years ago

Hi,

I asked this issue here but no answer has been given till now.

Could someone here please give me some hints?

Regards

chrisgmorton commented 4 years ago

Hi, I noticed your issue while looking at the latest developments with Mayavi and VTK 9. You don't mention which OS platform you are on or which version of VTK you are trying to build so I'll give you what I know and hopefully that will help you move forward.

If you are trying to build VTK 8 then you'll have to install a patch on VTK 8.2 as there are changes to Python's api that lead to problems with building VTK 8.2 against the Python 3.8 release. These api issues are addressed already in VTK 9.0. A patch was posted for this called 0001-Compatibility-for-Python-3.8.patch available in:

https://gitlab.kitware.com/vtk/vtk/-/issues/17670

Then on unix-like systems, install with something of the form:

tar -xvf archive/VTK-8.2.0.tar.gz
# Apply the python3.8 patch
cd VTK-8.2.0
cp ../archive/0001-Compatibility-for-Python-3.8.patch .
patch -p1 <  ./0001-Compatibility-for-Python-3.8.patch

I can confirm that this fixes the build issues and runs with the latest Mayavi release. You'll have to comment out the vtk dependency line in mayavi/__init__.py though otherwise you get a VTK 9.0 wheel install on top of your VTK 8.2 install. See: #927

My other guess is that you are trying to build the VTK 9.0 release. Rather surprisingly, this fails to build the VTK python wrappers when using CMAKE flags to point to your Python3.8 installation, as you are doing. There's a thread over on the VTK issues log:

https://gitlab.kitware.com/vtk/vtk/-/issues/17898#note_758051

The VTK issue owner indicated he thought this was a CMAKE bug--odd that they would not have spotted this prior to release. It indicates that there's another way to let the CMAKE system know where python is located, likely by setting environment variables, perhaps somewhere here:

(https://cmake.org/cmake/help/v3.17/module/FindPython.html)

or follow the link to the open CMAKE issue referenced in 20714.

I personally did not pursue VTK 9.0 when running into this same build issue (and then looking at other issues currently submitted against the release). Waiting for VTK 9.1.

hongyi-zhao commented 4 years ago

Thanks for your notes. My environment: Ubuntu 20.04 + python 3.8.3 + vtk git master version. I've got some more explanations about this problem.