# Creating venv virtual environment with vtkpython ?

**URL:** https://discourse.vtk.org/t/creating-venv-virtual-environment-with-vtkpython/15317
**Category:** Support
**Tags:** python
**Created:** [February 26, 2025, 2:58am UTC](https://discourse.vtk.org/t/creating-venv-virtual-environment-with-vtkpython/15317 "2025-02-26T02:58:38Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Nicholas\_Yue](https://discourse.vtk.org/user_avatar/discourse.vtk.org/nicholas_yue/32/3751_2.png) [@Nicholas\_Yue](https://discourse.vtk.org/u/Nicholas_Yue)
#### Post date: [February 26, 2025, 2:58am UTC](https://discourse.vtk.org/t/creating-venv-virtual-environment-with-vtkpython/15317/1 "2025-02-26T02:58:38Z")

</div>

I wish to create a VTK python virtual environment.

I tried

```auto
nyue@compute1:~/temp$ which vtkpython
/home/nyue/systems/VTK/9.4.1-static/bin/vtkpython
nyue@compute1:~/temp$ vtkpython -m venv .venv
Error: [Errno 2] No such file or directory: '/home/nyue/temp/.venv/bin/vtkpython'

```

Is that not the way to do that or should I not create virtual environment and take a different approach ?

Or should I approach this from another perspective, create a virtual environment the usual way

```auto
python3 -m venv .venv

```

Activate the virtual environment and install vtk

```auto
.venv\bin\activate
python -m pip install vtk

```

Just wondering which is the recommended approach and their pros/cons

---

<div class="post-metadata">

### Author: ![danlipsa](https://discourse.vtk.org/user_avatar/discourse.vtk.org/danlipsa/32/390_2.png) [@danlipsa](https://discourse.vtk.org/u/danlipsa)
#### Post date: [February 26, 2025, 3:43pm UTC](https://discourse.vtk.org/t/creating-venv-virtual-environment-with-vtkpython/15317/2 "2025-02-26T15:43:09Z")

</div>

The simplest way to use VTK in a venv is to install it: ‘pip install vtk’. (this will install the latest version)  
Then you use it as any other python package.

Dan

---

<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: [February 26, 2025, 4:09pm UTC](https://discourse.vtk.org/t/creating-venv-virtual-environment-with-vtkpython/15317/3 "2025-02-26T16:09:44Z")

</div>

You can also enable your home-built vtkpython in the venv by creating a link:

```plaintext
ln -s /home/nyue/systems/VTK/9.4.1-static/bin/vtkpython /home/nyue/temp/.venv/bin/vtkpython

```
