No module named 'vtkCommonCorePython' - import vtk

I am on Windows 10, Python 3.7.11, conda 4.10.3.
I ran both conda install vtk and pip install vtk, and they ran fine.

When I try
import vtk

I get back:

ImportError                               Traceback (most recent call last)
D:\user_data\Program_Files\Anaconda3\envs\tensorflow\lib\site-packages\vtkmodules\ in <module>
      4     # use relative import for installed modules
----> 5     from .vtkCommonCorePython import *
      6 except ImportError:

ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

ModuleNotFoundError                       Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_3128/ in <module>
----> 1 import vtk

D:\user_data\Program_Files\Anaconda3\envs\tensorflow\lib\site-packages\ in <module>
     30     all_spec = importlib.util.find_spec('vtkmodules.all')
     31     all_m = importlib.util.module_from_spec(all_spec)
---> 32     all_spec.loader.exec_module(all_m)
     34     # import vtkmodules

D:\user_data\Program_Files\Anaconda3\envs\tensorflow\lib\site-packages\vtkmodules\ in <module>
      6 # --------------------------------------
----> 7 from .vtkCommonCore import *
      8 from .vtkCommonMath import *
      9 from .vtkCommonMisc import *

D:\user_data\Program_Files\Anaconda3\envs\tensorflow\lib\site-packages\vtkmodules\ in <module>
      7     # during build and testing, the modules will be elsewhere,
      8     # e.g. in lib directory or Release/Debug config directories
----> 9     from vtkCommonCorePython import *

ModuleNotFoundError: No module named 'vtkCommonCorePython'

Any ideas how to troubleshoot?

I think you need something like:

from vtkmodules.vtkCommonCorePython import *

Try running one of the examples in vtk-examples e.g. CylinderExample. In this example the specific classes are imported along with these two modules which you will usually need to import:

# noinspection PyUnresolvedReferences
import vtkmodules.vtkInteractionStyle
# noinspection PyUnresolvedReferences
import vtkmodules.vtkRenderingOpenGL2

A good trick is to replace all your imports initially with:

import vtkmodules.all as vtk

colors = vtk.vtkNamedColors()

then run VTKImportsForPython and add in the generated imports, you will also need to replace vtk.vtkNamedColors() with vtkNamedColors() so the code would then look something like this:

from vtkmodules.vtkCommonColor import vtkNamedColors

colors = vtkNamedColors()