VTK not found in python after conda install

I am attempting to install and run mayavi through python using conda on windows 10. I have run:

According to conda, I have vtk 8.2.0 installed after running these commands.

However, after attempting to start mayavi by running mayavi2, I get the following error:

Searching through other forum topics, I have added a PYTHONPATH environment variable to the directory containing vtkCommonCorePython.pyd:

Now, when attempting to import vtk in python I get the following:

Configuration Info:
Windows 10 Version 20H2 OS Build 19042.1110
conda version : 4.10.3
python version : 3.7.3.final.0
pyqt version: 5.9.2
vtk version: 8.2.0

On Windows, you probably need to manually add PATH entries to the main bin paths where the main DLLs live. This was fixed in VTK 9.0 with Python 3.9+ (through APIs that are not available before then, namely os.add_dll_directory).

Thanks for the quick response! regrettably it looks like Mayavi requires python 3.7, so I am stuck with VTK 8.2. I have added a PATH entry and a PYTHONPATH entry to that directory (C:\ProgramData\Miniconda3\envs\ssms_gias\Library\bin), and the error still persists.

Is there another environment variable that I should be using?

latest stack trace:

Entries in PATH:

PythonPath:
PYTHONPATH=C:\ProgramData\Miniconda3\envs\ssms_gias\Lib\site-packages\vtkmodules;C:\ProgramData\Miniconda3\envs\ssms_gias\Library\bin

Python 3.9 has more useful info there (like…the name of that not-found library), but you can use ProcessMonitor to figure out which library is actually not being found.

Thanks for the tip.

The dll that seems to not be found is tbb.dll, which as far as I can tell is Intel’s thread builder and should be non essential. All of the following were successfully checked at a file level (they went through the operations of CreateFile, QueryBasicInformationFile, CloseFile, CreateFileMapping, and Load Image successfully.

I have attached events that python.exe reported, if you are willing to take a closer look, although, it appeared that most of it was successful.

There were some calls to files that were never found, in particular:

python_attempt.CSV (631.4 KB)
python_attemptPML.PML (3.4 MB)

It’s essential if the SMP backend is TBB.

This is fine. Python tries extensions in order, so __init__.py is going to be attempted after those two .pyd extension filenames.

Hi Ben, thanks for your replies so far. I have tbb.dll from other applications, and have copied it into a source where it was found by the project. I am now able to get further, but now when importing vtkIOParallelPython I get the following error:

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

ProcMon shows no unresolved dependencies found, so I speculate that I have a wrong copy of tbb.dll. Would there be any place I can search to find the right version? Alternately, do you have any other thoughts?

The right tbb.dll is the one corresponding to the one VTK built against. You’ll have to interrogate Anaconda as to how it got TBB into the VTK build.