Python 3 Upgrade Guide¶
This guide is for users that have made custom Python workflows or have modified any Python scripts shipped with Deadline. If you aren’t using custom scripts and are relying on what Deadline ships, no further actions are required. You’ll automatically be migrated once Deadline’s migration is complete!
This feature is experimental. Deadline is currently undergoing the process of migrating from Python 2 to Python 3. If your workflow depends on our Python code, it’s not guaranteed to work in Python 3 just yet.
Deadline now ships a Python 3 installation alongside the existing Python 2 bundle. You can control the version of Python that Deadline uses in different workflows as outlined below:
All Events will run in the same sandbox and use the same Python version. This means that you cannot have some Events run in Python 2 and others in Python 3. Events shipped by Deadline are not currently Python 3 compatible.
You can change the Python version that Event Plugins use by navigating in the Deadline Monitor to
Tools > Configure Respository Options > Python Settings and modifying
Event Sandbox Python Version.
Each Plugin runs in its own sandbox. This means Plugins don’t have to run in the same Python version. Plugins shipped by Deadline are not currently Python 3 compatible.
Add a shebang line to the top of the Python Plugin file to explicitly choose a Python version.
Providing no shebang line or an invalid shebang line will default to Python 2
#!/usr/bin/env python2will use Python 2
#!/usr/bin/env python3will use Python 3
Example: Running the Blender plugin in Python 3:
At the top of the file add
The next time you run the plugin it will run in Python 3.
#!/usr/bin/env python3 from System import * from System.Diagnostics import * from System.IO import * from Deadline.Plugins import * from Deadline.Scripting import * def GetDeadlinePlugin(): return BlenderPlugin()
Deadline’s Python Environment¶
Choosing the Deadline Client’s Python Environment¶
By default, Deadline Client applications run in Python 2. The application’s Python is what runs the interface and any custom scripts. The interfaces and scripts shipped by Deadline are not fully Python 3 compatible.
There are three ways to specify the desired Python version for the Deadline Client applications. These are listed below in order of decreasing priority:
Passing the Python version as a command line argument¶
The Python version can be easily changed through the command line.
Go into the Deadline Client folder:
Launch a client application providing the command line argument -py-ver <Python version>
deadlinemonitor -py-ver 2
Setting an environment variable¶
Create an environment variable called
DCONFIG_PYTHON_VERSION with the value of the major version of Python.
DCONFIG_PYTHON_VERSION=2for Python 2
DCONFIG_PYTHON_VERSION=3for Python 3
Specifying the Python version in the configuration file¶
To specify the Python version for a Deadline application, create an entry in the ‘Deadline.ini` configuration file similar to:
<Application Name>PythonVersion=<Python Major Version>. For more information on these configuration files see Client Configuration Files.
For example: To run the Deadline Monitor in Python 3 you will need to add the following line to
Why are we upgrading to Python 3?
Our goal is to meet the recommendations of the VFX Platform, which as of CY2020 recommends using Python 3.7. As of January 1, 2020, Python 2 was sunset. This means that it is no longer supported and there will be no more updates even if someone finds a security problem. For more information see Sunsetting Python 2.
How to upgrade to Python 3?
Your custom/modified scripts, Plugins, and Events will need to eventually support Python 3. For more information see Porting Python 2 Code to Python 3.
To which version are we upgrading Python?
We are upgrading to Python 3.7 as recommended by VFXP CY2021.
How long do we have to migrate to Python 3?
The goal is to eventually remove Python 2 support for Deadline, but there is no set date yet. We will update our documentation when the date is set. To avoid having any disruptions, we recommend you start migrating to Python 3 as soon as possible.