Build paraview with python 3.7.3 but ModuleNotFoundError: No module named ‘vtkmodules.vtkCommonCorePython’

Dear Experts,
After i build the latest paraview with python 3.7.3, when i open “Python Shell” window it pop error message:

"
    Error: Could not import vtkCommonComputationalGeometry
    .....
    bin/Lib/site-packages\vtkmodules\vtkCommonCore.py", line 2, in <module>
    from .vtkCommonCorePython import *
    ModuleNotFoundError: No module named 'vtkmodules.vtkCommonCorePython'
"

I can find a file vtkCommonCorePython.pyd under the same directory with vtkCommonCore.py, but dont know how to solve this issue, seems it make python cannot work.

Another issues is about build debug version, my first try found one project need python37_d.lib, However after i install python37_d.lib, all projects link to python37_d.lib, but some project still require to link to python37_d.lib, like building project “WrappingPythonCore”, it said "LINK : fatal error LNK1104: cannot open file 'python37.lib' ", this really make me confused...

Could you please help me out?

Thanks and Best Regards,
Sharon

This issue is caused because i take paraview as a sub directory in my project
When I build paraview alone with python, there is no such issue, can it works OK
1 Like

Which version of ParaView? Which OS? Can you share you cmake configuration?

paraview is git clone from GitHub
OS is window 10.0
Python version is 3.7.3 stable release

I add “-DPARAVIEW_ENABLE_PYTHON=ON” in cmake config command line and then build a debug version of paraview

Are you using mvscc compiler ?
Are you building with ninja or visual studio ?

Hi Mathieu,
I use visual studio 2015 to build, qt is Qt5.10.1

Regards,
Sharon

Please build with ninja+mvscc.

See here : https://gitlab.kitware.com/paraview/paraview/blob/nightly-master/Documentation/dev/build.md

It is impossible to build a successful one with VisualStudio?
What’s the difference between these build methods?

Building with visual studio is not tested.
Ninja is much faster anyway.
Nothing prevent you from working in visual studio and building with ninja though.

I do not use nor know much about visual studio, so I can’t answer your questions.

Hi Mathieu,
Thank you for your kind help and reply!
I will have a try

Best Regards,
Sharon

Building with visual studio is not tested.

It’s not actively tested due to its slow speed, but it should work.

Another issues is about build debug version, my first try found one project need python37_d.lib, However after i install python37_d.lib, all projects link to python37_d.lib, but some project still require to link to python37_d.lib, like building project “WrappingPythonCore”, it said "LINK : fatal error LNK1104: cannot open file 'python37.lib' ", this really make me confused...

Building VTK in Debug mode and using Debug Python are two different things. What are you trying to do?

After i build the latest paraview with python 3.7.3, when i open “Python Shell” window it pop error message:

Python’s errors are really bad here. It found it, but failed to load it, usually because its dependencies (the other VTK libraries) are not in $PATH.

Hi Ben,
Thank you for your reply!
I build paraview in debug, I dont want to use Debug Python.
I also need build paraview in release.

For python, i just want it can work, no matter debug or release.

In my situation, there is a file vtkCommonCorePython.pyd under the same directory with vtkCommonCore.py, but i dont know why it not work…

Best Regards,
Sharon

Then things are probably OK on the Python side. The loading is likely failing due to DLL load errors. Does it work if you add /path/to/paraview/.dll/files to the PATH environment variable?

Hi Ben,
I found if i build paraview alone, it is OK.
However in my situation, paraview is a sub-directory, i wrote a cmake file to add paraview folder when build.
This caused this error, but i dont know how to solve this issue…

Oh, you do add_subdirectory(ParaView)? I’d recommend building ParaView on its own and then doing find_package(ParaView) to build against it. ParaView’s CMake code probably has numerous places where it assumes that it is the top-level project being built.

Hi Ben,
Yes, I do 'add_subdirectory(ParaView)`, all the DLLs are builded correctly, only python is wrong

You are right, seems build paraview alone with python, there is no such issue.
This is caused by taking paraview as a sub directory.
Thank you for your suggestion, in fact i prefer to build paraview and my plugins together, however, if I cannot solve this issue, I may have to take your suggestion to first build paraview, then use find_package…

Thank you for your kind help!
Best Regards,
Sharon

This issue is caused because i take paraview as a sub directory in my project
When I build paraview alone with python, there is no such issue, can it works OK

Thank you for your suggestion, in fact i prefer to build paraview and my plugins together, however, if I cannot solve this issue, I may have to take your suggestion to first build paraview, then use find_package…

You can place the plugin under the Plugins/ directory of ParaView and it will be picked up automatically by ParaView. This is more of a one-off solution though. On master, ParaView is now capable of making an SDK on all platforms, so using an installed ParaView is the suggested way to do it today.

The core problem is caused by the required dll files not being in PATH when loading the Python modules. pvpython lives next to them and that just works, but when using an external Python, extra help is required to get them to be found on Windows.

Thank you Ben for your help!
Since I don’t want to change anything inside paraview, so we take it outside of paraview…

i will try the second option first.

Thanks and Best Regards,
Sharon

There is plugin documentation here if you need it: https://kitware.github.io/paraview-docs/nightly/cxx/PluginHowto.html It lacks information on prepping them for distribution, but feedback on what information would be useful would help us focus on what parts need improvement.

Thank you Ben!
Much appreciate it!
Best Regards,
Sharon