# Python Manager 0.0.3 ## Introduction Python Manager is a TouchDesigner component that simplifies managing and installing external Python libraries within your projects. It uses a virtual environment (venv) to maintain an isolated Python setup, ensuring that additional libraries can be installed and managed without affecting TouchDesigner's Python environment. ## Initial Setup ### Creating and Configuring the Virtual Environment (`Createvenv` pulse) - To set up Python Manager, first click the `Createvenv` pulse. This opens a folder selection menu. - You can either select a folder or use a path specified in the `Basefolder` parameter. Python Manager will build the virtual environment (`venv`) and use the correct version of Python automatically. - If the correct version of Python for your TouchDesigner installation is not installed on your system, a popup window will appear with a download link. - The `Basefolder` parameter will be set to the chosen folder, completing the initial setup process. - After creating the virtual environment, click the `Addtosyspath` pulse. This adds the virtual environment’s packages to TouchDesigner’s system path, making installed libraries available for import. ## Usage in Different Projects Once configured, the Python Manager can effectively link multiple TouchDesigner projects to the same virtual environment. As long as the `Basefolder` remains unchanged and the virtual environment is in the same location on your computer, this setup ensures a consistent Python environment across different projects. ## Managing Python Packages (Page: PIP) ### Installing Packages (`Pipinstall` pulse - Label: Pip Install) - To install a package, enter the package name in the `Pippackage` (Label: Python Library) field and click the `Pipinstall` pulse. - You can access this functionality via script: `op('python_manager').Pipinstall('package_name')`. ### Uninstalling Packages (`Pipuninstall` pulse - Label: Pip Uninstall) - Enter or select the package name in `Pippackage` (Label: Python Library) and click the `Pipuninstall` pulse to remove it. - Accessible via script: `op('python_manager').Pipuninstall('package_name')`. ### Updating Packages (`Pipupdate` pulse - Label: Pip Update) - Enter or select the package name in `Pippackage` (Label: Python Library) and click the `Pipupdate` pulse to update a package to the latest version. - Script access: `op('python_manager').Pipupdate('package_name')`. ### Installing from a List (`Pipinstallfromlist` pulse - Label: Pip Install From List (in1)) - The `Pipinstallfromlist` pulse installs packages listed in the `in1` DAT, formatted like a requirements.txt file. - Sample format in `in1` DAT: ``` matplotlib==3.6.0 pandas scikit-learn ``` - This can also be performed via script: `op('python_manager').Pipinstallfromlist()`. ### Listing Installed Packages (`Listinstalledpackages` pulse - Label: List Current Packages) - Updates the package list of all packages installed in the virtual environment. - Access via script: `op('python_manager').Listinstalledpackages()`. ## Additional Functionalities (Page: Setup venv) ### Setting Python Executable (`Setpython` pulse - Label: Set Python Executable) - Automatically locates and sets the compatible Python executable. This function is automatically run when creating a venv, but might be necessary for configuring a project. ### Generating Requirements.txt (`Createreqtxt` pulse - Label: Create requirements.txt) - Creates a requirements.txt file in your Base Folder with a list of installed packages. ### Opening the Virtual Environment (`Openvenv` pulse - Label: Open Virtual Env (venv)) - Activates and opens the virtual environment in a command window, allowing manual command-line interactions. ### Resetting the Operator (`ResetOp`) - Clears the current settings and prepares Python Manager for reconfiguration or use in a different project.