Whether you are a professional coder or a beginner, every patch can benefit from a few life-saving components, and this is where the new TouchDesigner Python Environment Manager comes into play.
The latest experimental release of TouchDesigner marks a milestone in the evolution of our beloved creative environment. Alongside the introduction of the revolutionary POP operators, several new features deserve a closer look, one of which is the TDPyEnvManager component. But first, let’s take a step back.
What is a Python Virtual Environment?
A virtual environment (venv) is an isolated environment created on top of an existing Python installation. Unlike the main environment, it can include only the specific packages required for a project, rather than all the packages available in the global Python installation.
There are several benefits to this. First, a venv is usually lightweight compared to the main installation, since it contains only the selected packages and libraries. In addition, it provides its own Python interpreter, libraries, and binaries necessary to support a project. By default, these components are isolated from other virtual environments as well as from the Python interpreter and libraries installed on the operating system.
Most importantly, when running a Python script on different computers, you may encounter dependency errors and compatibility issues. A virtual environment helps prevent these problems by keeping the required dependencies consistent and isolated for each project.
The TDPyEnvManager supports the conda environment as well. Have a look at this article for more information about conda management.
Virtual Environments in TouchDesigner
As you can imagine from the previous paragraphs, using a virtual environment is essential when working with third-party libraries not included in TouchDesigner, especially if you need to run your patch on another computer, such as a standalone computer for an interactive installation. Since I do not have a background in computer science, I have lost count of the times I have been stuck due to compatibility issues with libraries or dependencies. This is why virtual environments are a strategic component of our workflow.
Get Our 7 Core TouchDesigner Templates, FREE
We’re making our 7 core project file templates available – for free.
These templates shed light into the most useful and sometimes obtuse features of TouchDesigner.
They’re designed to be immediately applicable for the complete TouchDesigner beginner, while also providing inspiration for the advanced user.
Python Venv Made Easy: TDPyEnvManager
Since the team at Derivative always cares about our needs, the new experimental release introduces a powerful tool for managing virtual environments: TDPyEnvManager.
It is a custom component available in the Palette window, designed to make it easy to integrate third-party Python libraries with almost no coding required. The environments created with it are automatically added to TouchDesigner’s Python path.
With this tool, installing the libraries you need becomes straightforward (see below), and they are immediately ready to be used inside your scripts for any purpose.
In addition, TDPyEnvManager allows you to export a requirements.txt file with a single click or import an existing one directly into your virtual environment.

A Simple Example with TDPyEnvManager
The component is quite self-explanatory, but let’s take a closer look at how it works.
First, we click on the Active pulse button. Then, we create the environment by clicking on the Create vENV pulse button. After a short while, a corresponding folder will appear inside our project directory, containing the newly created virtual environment.
Next, to install third-party libraries, we click on the Open CLI pulse button to launch the command prompt. From there, we can install the required libraries using the standard pip command.
In my patch, for example, I chose to install SciPy, an extremely powerful library for advanced scientific computing. Once installed, I created a Script DAT with a very simple demo script:
import scipy.stats as stats
def onPulse(par):
return
def onCook(scriptOp):
scriptOp.clear()
n = 200000
scriptOp.appendRow(["index", "col1", "col2"])
for i in range(n):
val1 = stats.uniform.rvs(loc=-1, scale=2)
val2 = stats.uniform.rvs(loc=-1, scale=2)
scriptOp.appendRow([i, round(val1, 4), round(val2, 4)])
return
The script simply imports the SciPy library and generates 20,000 random numbers in a Table DAT, which is then used for instancing a circle. Of course, this could also be achieved with other techniques, but the visual output is not the focus of this article.
And voilà, our patch is ready to be shared, without any dependency or compatibility concerns.

Wrap Up
While still in its experimental phase, I believe the TouchDesigner Python Environment Manager will play a key role in the future, both for handling complex projects and for simplifying the integration of external Python libraries within TouchDesigner. Although it may seem intimidating at first, mastering these technical aspects will ultimately make your projects much easier to manage. And, as always, the sky is the limit.