# Building VTK from source in windows for python or 'CameraOrientationWidget'

**URL:** https://discourse.vtk.org/t/building-vtk-from-source-in-windows-for-python-or-cameraorientationwidget/6557
**Category:** Support
**Created:** [September 5, 2021, 8:53pm UTC](https://discourse.vtk.org/t/building-vtk-from-source-in-windows-for-python-or-cameraorientationwidget/6557 "2021-09-05T20:53:50Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Aymane\_Gr](https://discourse.vtk.org/user_avatar/discourse.vtk.org/aymane_gr/32/3695_2.png) [@Aymane\_Gr](https://discourse.vtk.org/u/Aymane_Gr)
#### Post date: [September 5, 2021, 8:53pm UTC](https://discourse.vtk.org/t/building-vtk-from-source-in-windows-for-python-or-cameraorientationwidget/6557/1 "2021-09-05T20:53:50Z")

</div>

Hello everyone i hope you’re doing well,

As a newbie, i installed vtk from python using pip install vtk. However i had an error when using **cam\_orient\_manipulator = vtk.vtkCameraOrientationWidget()** claiming that vtk has no attribute named vtkCameraOrientationWidget. My question is this call deprecated by now ? i can’t find any other references, whatsoever.

I have then tought that maybe that is a recent feature so i downloaded the source from the website , and compiled it with cMake, checked the configuration for python and build it with visual studio code. ( This operation took me 1 day to figure out). But now i have another error :

 ![image](https://discourse.vtk.org/uploads/default/original/2X/6/65754b3607dcbe83f5a1832114a3dfe3623f3827.png)

Can you please help me figuring out either the first or second error ? Thanks for your assistance !

---

<div class="post-metadata">

### Author: ![amaclean](https://discourse.vtk.org/user_avatar/discourse.vtk.org/amaclean/32/224_2.png) [@amaclean](https://discourse.vtk.org/u/amaclean)
#### Post date: [September 6, 2021, 8:32am UTC](https://discourse.vtk.org/t/building-vtk-from-source-in-windows-for-python-or-cameraorientationwidget/6557/2 "2021-09-06T08:32:45Z")

</div>

`vtkCameraOrientationWidget()` is only in the master. So building VTK is the only way to access it at this stage. Make sure when building VTK that the Python wrapping is also built. After that is done, go to [CameraOrientationWidget](https://kitware.github.io/vtk-examples/site/Python/Widgets/CameraOrientationWidget/) and copy the Python code. If that runs then your build is Ok. Also please check your paths.

---

<div class="post-metadata">

### Author: ![Aymane\_Gr](https://discourse.vtk.org/user_avatar/discourse.vtk.org/aymane_gr/32/3695_2.png) [@Aymane\_Gr](https://discourse.vtk.org/u/Aymane_Gr)
#### Post date: [September 9, 2021, 9:48am UTC](https://discourse.vtk.org/t/building-vtk-from-source-in-windows-for-python-or-cameraorientationwidget/6557/3 "2021-09-09T09:48:59Z")

</div>

Hello, thank you for you answer.  
I have already built vtk with python\_wrap. It generates the “.py” files in “C:\vtk\bin\bin\Lib\site-packages” and a folder called “vtkmodules” where there is plenty of “.py” files. I added “C:\vtk\bin\Libe\site-packages” in PYTHONPATH but i still have the error shown above. Thank you!

---

<div class="post-metadata">

### Author: ![amaclean](https://discourse.vtk.org/user_avatar/discourse.vtk.org/amaclean/32/224_2.png) [@amaclean](https://discourse.vtk.org/u/amaclean)
#### Post date: [September 9, 2021, 10:29pm UTC](https://discourse.vtk.org/t/building-vtk-from-source-in-windows-for-python-or-cameraorientationwidget/6557/4 "2021-09-09T22:29:22Z")

</div>

It looks like the VTK dlls are not being accessed. There is a little script called `windows_path.bat` in the top level of your build directory. This contains the path settings for VTK. Make sure you add these before running your Python code.

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [September 9, 2021, 11:37pm UTC](https://discourse.vtk.org/t/building-vtk-from-source-in-windows-for-python-or-cameraorientationwidget/6557/5 "2021-09-09T23:37:06Z")

</div>

In Python 3.9 the PATH is not searched for DLLs needed by the python modules:

> [@](#):
>
> DLL dependencies for extension modules and DLLs loaded with ctypes on Windows are now resolved more securely. Only the system paths, the directory containing the DLL or PYD file, and directories added with add\_dll\_directory() are searched for load-time dependencies. Specifically, PATH and the current working directory are no longer used, and modifications to these will no longer have any effect on normal DLL resolution.

In the VTK master branch, VTK sets the DLL paths in `vtkmodules/ __init__.py`, but for VTK 9.0 (including 9.0.3), your best bet is to use `vtkpython.exe` instead of `python.exe` or `py.exe`.
