I’m running python 3.10.9 on Windows 10 Pro. Steps to reproduce: I create a new virtualenv with python -m venv env
then run pip install vtk
, which installs vtk version 9.2.6. Then, when I try to simply import vtk
in the python shell, I get this error:
File “C:\Users[my name]\Documents\DebuggingVTK\env\lib\site-packages\vtk.py”, line 4, in
from vtkmodules.vtkCommonCore import *
ImportError: DLL load failed while importing vtkCommonCore: The specified module could not be found.
I’ve tried running os.add_dll_directory(r'C:\Users\[my name]\Documents\DebuggingVTK\env\lib\site-packages\vtkmodules')
, but that didn’t change anything. I’ve also tried adding this directory to PATH and PYTHONPATH.
I could possibly build vtk from source, but the project is set up to pip install it from requirements.txt, plus other people might have this issue, so it’d be great to figure out if there’s a workaround this way.
I really appreciate any help. I’ve been stuck on this all day.