Python Scripting
How to set up Python Environment in Sequentum Enterprise
NOTE:
Sequentum Enterprise currently supports Python 3.7 and higher versions up to Python 3.12 and it must be installed at C:\Program Files\Python<version_number> path for all users on the Server or Desktop running with Sequentum Enterprise software.
Examples:
For Python 3.7: C:\Program Files\Python37
For Python 3.8: C:\Program Files\Python38
For Python 3.12: C:\Program Files\Python312
For using Anaconda3 with Sequentum Enterprise, you can use either the latest installer 2024.06 or the older version 2020.02, both of which are compatible with the latest version of Sequentum Enterprise.
Python 3.12 recommended installation steps
Step 1: Download the Python 3.12 64-bit Windows Installer.
Step 2: Run the Installer.
Step 3: Check the Python version installed on your Windows machine using command prompt and install the popular Python Pandas library:
Open command prompt and type python --version to get the python version installed.
Use pip command to install any external Python library
For example:
Use pip install pandas to install the Pyhton Pandas library on your machine.
Anaconda3 recommended installation steps
Step 1: Download the Anaconda installer.
Step 2: Run the Installer.
NOTE:
Install Anaconda to a directory path that does not contain spaces or Unicode characters.
To see if the conda installation of Python is in your PATH variable, open an Anaconda Prompt and run echo %PATH%.
To see which Python installation is currently set as the default, open an Anaconda Prompt and run where python.
To install the Pandas library in Anaconda, open an Anaconda Prompt and run:
conda install -c anaconda pandas
Once the desired Python or Anaconda3 is set-up on your machine, follow the below steps to start using Python with the Sequentum Enterprise software:
Go to Agent Command and click the edit option.
Go to the Properties tab.
In the Agent, Properties go to Scripting.
Go to Python Engine, which specifies the type of Python engine you want to use in your agent, and select Embedded which is set by default and uses IronPython or External which supports Python 3.7 and higher versions till 3.12 CPython libraries.
Embedded: To use the IronPython which is an open-source implementation of the Python programming language which is tightly integrated with the .NET Framework, select the Embedded Python Engine option.
External: To use the available Python versions which support the CPython libraries such as Numpy and Pandas, select the External Python Engine option. Anaconda 3 is recommended as the python external engine. Both the External Python Engines must be installed separately on the Windows machine.
Go to Environment and select the environment variable for the agent such as None, Anaconda 3, Python37, Python 38, Python 39, Python 310, Python 311, Python312, or Custom based on Python Engine property value. If you select the Embedded as a Python engine, then you need to remain with the default environment value i.e. None. If you select the External as Python engine, then the Environment property needs to be set to Anaconda3 or Python37, Python 38, Python 39, Python 310, Python 311, Python312, or a Custom value depending upon the Python setup on the Windows machine.
Go to Custom Environment and specify the custom environment variables for the agent If you selected the Environment property as Custom in step 5. Individual environment variables must be separated by a new line. Example: PATH = C:\Program Files\Python312
Performance Considerations
Sequentum Enterprise must lock the Python GIL (Global Interpreter Lock) when executing a Python script using external Python. This means external Python scripts cannot run concurrently in a single agent session. Python scripts in different performance sessions can always run concurrently. Embedded Python does not use a GIL and therefore can also always run concurrently.
Sequentum Enterprise will often run HTML and JSON parsers concurrently, so an agent using parsers should avoid long-running external Python scripts in the parts of the agent that are processed by parsers.
An agent that only uses dynamic web browsers rarely processes any parts of the agent concurrently, so external Python scripts can often be used without a performance penalty.
Python scripts using external Python are best used in agent Initialization and Export scripts because they never run concurrently.