# VTK not found in python after conda install

**URL:** https://discourse.vtk.org/t/vtk-not-found-in-python-after-conda-install/6251
**Category:** Support
**Created:** [July 27, 2021, 1:06pm UTC](https://discourse.vtk.org/t/vtk-not-found-in-python-after-conda-install/6251 "2021-07-27T13:06:34Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![sandwich](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sandwich/32/3708_2.png) [@sandwich](https://discourse.vtk.org/u/sandwich)
#### Post date: [July 27, 2021, 1:06pm UTC](https://discourse.vtk.org/t/vtk-not-found-in-python-after-conda-install/6251/1 "2021-07-27T13:06:34Z")

</div>

I am attempting to install and run [mayavi](https://docs.enthought.com/mayavi/mayavi/) through python using conda on windows 10. I have run:

> [@](#):
>
> ```
> conda create -n ssms_gias python=3.7
> conda install -n ssms_gias pyqt=5
> conda install -n ssms_gias -c menpo mayavi
> 
> ```

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:

> [@](#):
>
> ImportError: No module named ‘vtkCommonCorePython’

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

> [@](#):
>
> PYTHONPATH=C:\ProgramData\Miniconda3\envs\ssms\_gias\Lib\site-packages\vtkmodules

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

> [@](#):
>
> Traceback (most recent call last):  
> File “C:\ProgramData\Miniconda3\envs\ssms\_gias\lib\site-packages\vtkmodules\vtkCommonCore.py”, line 5, in   
> from .vtkCommonCorePython import \*  
> ImportError: DLL load failed: The specified module could not be found.
> 
> During handling of the above exception, another exception occurred:
> 
> Traceback (most recent call last):  
> File “”, line 1, in   
> File “C:\ProgramData\Miniconda3\envs\ssms\_gias\lib\site-packages\vtk.py”, line 32, in   
> all\_spec.loader.exec\_module(all\_m)  
> File “C:\ProgramData\Miniconda3\envs\ssms\_gias\lib\site-packages\vtkmodules\all.py”, line 7, in   
> from .vtkCommonCore import \*  
> File “C:\ProgramData\Miniconda3\envs\ssms\_gias\lib\site-packages\vtkmodules\vtkCommonCore.py”, line 9, in   
> from vtkCommonCorePython import \*  
> ImportError: DLL load failed: The specified module could not be found.

**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

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [July 27, 2021, 1:15pm UTC](https://discourse.vtk.org/t/vtk-not-found-in-python-after-conda-install/6251/2 "2021-07-27T13:15:42Z")

</div>

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`).

---

<div class="post-metadata">

### Author: ![sandwich](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sandwich/32/3708_2.png) [@sandwich](https://discourse.vtk.org/u/sandwich)
#### Post date: [July 27, 2021, 1:37pm UTC](https://discourse.vtk.org/t/vtk-not-found-in-python-after-conda-install/6251/3 "2021-07-27T13:37:33Z")

</div>

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:

> [@](#):
>
> $ python -c “import vtk”  
> Traceback (most recent call last):  
> File “C:\ProgramData\Miniconda3\envs\ssms\_gias\lib\site-packages\vtkmodules\vtkCommonCore.py”, line 5, in   
> from .vtkCommonCorePython import \*  
> ImportError: DLL load failed: The specified module could not be found.
> 
> During handling of the above exception, another exception occurred:
> 
> Traceback (most recent call last):  
> File “”, line 1, in   
> File “C:\ProgramData\Miniconda3\envs\ssms\_gias\lib\site-packages\vtk.py”, line 32, in   
> all\_spec.loader.exec\_module(all\_m)  
> File “C:\ProgramData\Miniconda3\envs\ssms\_gias\lib\site-packages\vtkmodules\all.py”, line 7, in   
> from .vtkCommonCore import \*  
> File “C:\ProgramData\Miniconda3\envs\ssms\_gias\lib\site-packages\vtkmodules\vtkCommonCore.py”, line 9, in   
> from vtkCommonCorePython import \*  
> ImportError: DLL load failed: The specified module could not be found.

Entries in `PATH`:

> [@](#):
>
> C:\ProgramData\Miniconda3\envs\ssms\_gias  
> C:\ProgramData\Miniconda3\envs\ssms\_gias\Library\mingw-w64\bin  
> C:\ProgramData\Miniconda3\envs\ssms\_gias\Library\usr\bin  
> C:\ProgramData\Miniconda3\envs\ssms\_gias\Library\bin  
> C:\ProgramData\Miniconda3\envs\ssms\_gias\Scripts  
> C:\ProgramData\Miniconda3\envs\ssms\_gias\bin  
> C:\ProgramData\Miniconda3  
> C:\ProgramData\Miniconda3\Library\mingw-w64\bin  
> C:\ProgramData\Miniconda3\Library\usr\bin  
> C:\ProgramData\Miniconda3\Library\bin  
> C:\ProgramData\Miniconda3\Scripts  
> C:\ProgramData\Miniconda3\bin  
> C:\ProgramData\Miniconda3\condabin  
> C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common  
> C:\WINDOWS\system32  
> C:\WINDOWS  
> C:\WINDOWS\System32\Wbem  
> C:\WINDOWS\System32\WindowsPowerShell\v1.0  
> C:\WINDOWS\System32\OpenSSH  
> C:\Program Files\Docker\Docker\resources\bin  
> C:\ProgramData\DockerDesktop\version-bin  
> C:\Program Files\MySQL\MySQL Shell 8.0\bin  
> C:\ProgramData\Miniconda3\envs\ssms\_gias\Library\bin

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

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [July 27, 2021, 3:31pm UTC](https://discourse.vtk.org/t/vtk-not-found-in-python-after-conda-install/6251/4 "2021-07-27T15:31:45Z")

</div>

Python 3.9 has more useful info there (like…the name of that not-found library), but you can use [ProcessMonitor](https://docs.microsoft.com/en-us/sysinternals/downloads/procmon) to figure out which library is actually not being found.

---

<div class="post-metadata">

### Author: ![sandwich](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sandwich/32/3708_2.png) [@sandwich](https://discourse.vtk.org/u/sandwich)
#### Post date: [July 27, 2021, 5:05pm UTC](https://discourse.vtk.org/t/vtk-not-found-in-python-after-conda-install/6251/5 "2021-07-27T17:05:55Z")

</div>

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.

> [@](#):
>
> vtkCommonCorePython37D-8.2.dll  
> VCRUNTIME140\_1.dll  
> vtkWrappingPython37Core-8.2.dll  
> vtkCommonCore-8.2.dll  
> vtksys-8.2.dll

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:

> [@](#):
>
> **init**.cp37-win\_amd64.pyd  
> **init**.pyd  
> python37.\_pth  
> python.\_pth  
> python37.zip  
> pyvenv.cfg  
> tbb.dll

[python\_attempt.CSV](https://discourse.vtk.org/uploads/short-url/9vYke7PDHR35gs8bOmb3dBbbMdk.CSV) (631.4 KB)  
[python\_attemptPML.PML](https://discourse.vtk.org/uploads/short-url/2F04iz6J1HZUBTXcMpIkz3MCIz1.PML) (3.4 MB)

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [July 27, 2021, 5:54pm UTC](https://discourse.vtk.org/t/vtk-not-found-in-python-after-conda-install/6251/6 "2021-07-27T17:54:08Z")

</div>

> [@sandwich](#):
>
> 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.

It’s essential if the SMP backend is TBB.

> [@sandwich](#):
>
> There were some calls to files that were never found

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

---

<div class="post-metadata">

### Author: ![sandwich](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sandwich/32/3708_2.png) [@sandwich](https://discourse.vtk.org/u/sandwich)
#### Post date: [July 28, 2021, 9:25am UTC](https://discourse.vtk.org/t/vtk-not-found-in-python-after-conda-install/6251/7 "2021-07-28T09:25:13Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [July 28, 2021, 1:16pm UTC](https://discourse.vtk.org/t/vtk-not-found-in-python-after-conda-install/6251/8 "2021-07-28T13:16:53Z")

</div>

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.
