# DLL load failed while importing vtkRenderingOpenVR

**URL:** https://discourse.vtk.org/t/dll-load-failed-while-importing-vtkrenderingopenvr/10449
**Category:** VR/AR
**Created:** [January 14, 2023, 3:57am UTC](https://discourse.vtk.org/t/dll-load-failed-while-importing-vtkrenderingopenvr/10449 "2023-01-14T03:57:21Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![banesullivan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/banesullivan/32/7143_2.png) [@banesullivan](https://discourse.vtk.org/u/banesullivan)
#### Post date: [January 14, 2023, 3:57am UTC](https://discourse.vtk.org/t/dll-load-failed-while-importing-vtkrenderingopenvr/10449/1 "2023-01-14T03:57:21Z")

</div>

After building VTK (latest `release` branch) on Windows succussfully and generating a wheel, when I try to `import vtk` in Python, I get an error loading the DLL for `vtkRenderingOpenVR`:

```auto
>>> import vtk
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\banes\miniconda3\envs\vtkvr\lib\site-packages\vtk.py", line 31, in <module>
    all_m = importlib.import_module('vtkmodules.all')
  File "C:\Users\banes\miniconda3\envs\vtkvr\lib\importlib\ __init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "C:\Users\banes\miniconda3\envs\vtkvr\lib\site-packages\vtkmodules\all.py", line 50, in <module>
    from .vtkRenderingOpenVR import *
ImportError: DLL load failed while importing vtkRenderingOpenVR: The specified module could not be found.

```

Any tips on how to fix this?

I see `vtkRenderingOpenVR-9.2.dll` in `vtkmodules` so I’m not too sure what’s going wrong.

~This is Python 3.9 so maybe I should upgrade to 3.10 or 3.11 to maybe get more insight into what’s failing to load~ upgrading to Python 3.11 made no difference

---

<div class="post-metadata">

### Author: ![banesullivan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/banesullivan/32/7143_2.png) [@banesullivan](https://discourse.vtk.org/u/banesullivan)
#### Post date: [January 14, 2023, 4:25am UTC](https://discourse.vtk.org/t/dll-load-failed-while-importing-vtkrenderingopenvr/10449/2 "2023-01-14T04:25:28Z")

</div>

Aha! Copy/pasting `openvr_api.dll` into the install `vtkmodules` path fixed the issue. I wonder if there’s a way I can easily include that in the wheel?

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [January 17, 2023, 1:03pm UTC](https://discourse.vtk.org/t/dll-load-failed-while-importing-vtkrenderingopenvr/10449/3 "2023-01-17T13:03:44Z")

</div>

I dont know much about the way wheel are handled (@ben.boeckel ), but you could add the dll location to your PATH instead.

---

<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: [January 19, 2023, 7:11pm UTC](https://discourse.vtk.org/t/dll-load-failed-while-importing-vtkrenderingopenvr/10449/4 "2023-01-19T19:11:37Z")

</div>

Python 3.9+ require `os.add_dll_directory()`. You can add it to the VTK’s `VTK_DLL_PATHS` CMake variable, but that pins OpenVR to that location on whatever wants to import everything from VTK. I have no idea what packaging tooling (if any) exists to copy required DLLs into the wheel.
