Configuring Python for use with Analytics
Note
These configuration instructions refer to a customer-installed instance of Python required to use the ACLScript Python command (PYCOMMAND), or the ACLScript Python functions. This instance of Python is not the same as the instance of Python that can be installed as part of the Analytics installation to support machine learning commands.
Analytics gives you different options for integrating the Python programming language and Python scripting with your data automation and data analysis workflows.
Analytics functional area | Python bitness required | Python version supported | Python set-up method |
---|---|---|---|
|
3.12.4 (tested) Other versions of Python will probably work, but have not been tested. |
Customer installs and configures Python separately from Analytics See Configuring Python to support the ACLScript Python command |
|
|
3.7.x or newer |
Customer installs and configures Python separately from Analytics See Configuring Python to support ACLScript Python functions |
|
|
3.7.9 |
Customer selects the optional Python installation during the Analytics installation process |
Configuring Python to support the ACLScript Python command
Install and configure Python to support use of the ACLScript Python command (PYCOMMAND). The Python command allows you to seamlessly integrate Analytics scripting and Python scripting, and move data back and forth between the two environments.
Install Python (64-bit or 32-bit)
Note
The ACLScript Python command can work with either 32-bit or 64-bit Python. We recommend installing 64-bit Python because it gives you more options for supported packages, and depending on the volume of data being processed, better performance.
-
From the Python downloads page, download a recent version of Python to your computer or the server.
The ACLScript Python command has been tested with Python 3.12.4. Other recent versions of Python should work, however they are not guaranteed to work.
-
On your computer or the server, double-click the Python installer.
-
In the installer, select Use admin privileges when installing py.exe.
-
Click Install Now and follow the on-screen instructions.
Add Python folder paths to the PATH environment variable
Add two folder paths for the Python installation to the PATH environment variable.
-
In the Windows taskbar, search on environment variables.
-
Select Edit the system environment variables.
The System Properties dialog box appears.
-
In the Advanced tab, select Environment Variables.
The Environment Variables dialog box appears.
-
In the System variables list, select Path, and select Edit.
The Edit environment variable dialog box appears.
-
Do the following to add two Python folder paths:
-
Select New and add this folder path (default Python installation location):
C:\Users\<USER>\AppData\Local\Programs\Python\Python<version>\
Note
If you installed Python in a different location, specify the correct path to the folder containing the Python executable (python.exe).
-
Select the newly added path and use Move Up to move the path to the top of the list.
-
Select New again and add this folder path, modified as required:
C:\Users\<USER>\AppData\Local\Programs\Python\Python<version>\Scripts
-
Select the second added path and use Move Up to move the path beneath the first path you added.
-
-
To save your changes, select OK in each dialog box:
-
Edit environment variable
-
Environment Variables
-
System Properties
-
-
Restart your computer or the server to ensure that the updates to the Path environment variable take effect.
Note
Depending on your operating system and environment, a restart may not be required. However, if the next set of steps does not work, restart your computer or the server before retrying the steps.
Create a Python virtual environment
Note
Creating a Python virtual environment is not required. You could use the base Python environment for your development work. However, working in a virtual environment is a good practice as it allows you to segregate different Python activities and sets of dependencies.
-
Create a Windows folder to contain the Python virtual environment.
For example, C:\Python_ACL_integration.
-
Open a Windows command prompt and Run as administrator.
-
Type python.exe --version and press Enter.
The version of Python that you installed should be returned. For example:
Python 3.12.4.If the command is not recognized by the Windows command prompt, your updates to the Path environment variable may not have taken effect. Restart your computer or the server and try again.
-
Switch to the folder you created for the Python virtual environment.
For example, cd C:\Python_ACL_integration.
-
To create the Python virtual environment, enter this command: python -m venv venv.
The first venv specifies that the Python venv module is used. The second venv names the virtual environment. You can specify a different name for the virtual environment if you want, but make sure the name makes obvious reference to a virtual environment.
You should now have a venv subfolder in the folder you created for the Python virtual environment. For example, C:\Python_ACL_integration\venv.
If creating the Python virtual environment was not successful, your updates to the Path environment variable may not have taken effect. Restart your computer or the server and try again.
-
To activate the Python virtual environment, enter this command: .\venv\Scripts\activate.
The command prompt should return the virtual environment folder prefaced with (venv). For example, (venv) c:\Python_ACL_integration>
-
To install the Pandas module in the Python virtual environment, enter this command: pip install pandas.
If the installation of Pandas is successful, the command prompt message should show a final line such as:
Successfully installed numpy-2.2.2 pandas-2.2.3 python-dateutil-2.9.0.post0 pytz-2024.2 six-1.17.0 tzdata-2025.1
Add the virtual environment path to the Analytics Options
-
Open Analytics.
-
From the Analytics main menu, select Tools > Options.
-
Select the System tab.
-
In the Python Path field, enter the full path and file name for the Python executable in the virtual environment that you just created.
For example, C:\Python_ACL_integration\venv\Scripts\python.exe
-
Click OK to save your changes.
Next steps
If installation and configuration of Python, the virtual environment, and Pandas was successful, you're ready to test the integration of Analytics and Python. For more information, see Integrating Python scripts or PYCOMMAND command.
Configuring Python to support ACLScript Python functions
To configure Python to work with Analytics, you must install a compatible version of Python and add the Python executable to your computer's PATH environment variable. You must also set the ACLPYTHONDLL and PYTHONPATH system environment variables.
How it works
To run Python scripts, Analytics must be able to call the Python executable and find the scripts it is instructed to run. Analytics uses the PATH environment variable to locate Python and the PYTHONPATH environment variable to locate scripts.
Install Python (32-bit)
- From the Python downloads page, download one of the following versions of Python to your computer or the server:
- 3.7.x
- 3.8.x
- 3.9.x
Note
The listed versions of Python have been tested and verified to work with Analytics or the Robots Agent.
Any version of Python from 3.7.x onward should work. However, versions other than those listed are not guaranteed to work.
- On your computer or the server, double-click the installer.
- In the installer, select Add Python versionNumber to PATH.
- Click Install and follow the on-screen instructions.
- Reboot the computer or the server before running any Python scripts called by an Analytics script.
Set the ACLPYTHONDLL and PYTHONPATH environment variables
- In the C:\ drive of the operating system, create one or more folders to house your Python scripts.
Example C:\python_scripts
- From the operating system, open the System Properties dialog box and click Environment Variables.
- In the System variables section, click New and enter the following variables:
Variable name Variable value PYTHONPATH The full path to the folder(s) you created to house the Python scripts. Separate multiple folder paths with a semi-colon.
Example:
C:\python_scripts;C:\dev;C:\tmp
ACLPYTHONDLL The full path and filename of the Python DLL file in the Python installation folder.
Example:
c:\python_install\python35.dll
Note
Upon installation, Python adds the DLL to the system folder (c:\windows\system32\python35.dll) rather than the installation folder. You must copy the DLL from the system folder to the installation folder, and use the installation folder location as the variable value. Analytics or the Robots Agent look for the DLL in the Python installation folder.
You may also need to remove any read-only settings from the installation folder.
- To save the variable, click OK and then in the System Properties dialog box, click OK.
Use Python in Analytics Python functions
From Analytics, use the Analytics Python functions to call functions in scripts that exist in your PYTHONPATH.
For more information, see Python.
Note
If you make any edits to a Python script, you must refresh the view in your Analytics project to use the latest version of the Python script. The simplest way to refresh the view is to close the table you are working with and then re-open it.