Troubleshooting Error "Python Scope: Error Initializing Python Engine"

Why is it not possible to successfully execute Python-based automation?

Issue Description:

Sometimes, while running the automation that leverages the Python Scope activity, the following error might be thrown,


Root Cause: Ideally, this error occurs when the Python Scope is misconfigured such that UiPath is unable to initiate a session with python.exe.


Troubleshooting steps: Following are some potentially helpful steps to diagnose / resolve this issue:

  1. Upgrade to the latest versions of the Python activity package, Python and .NET to ensure taking advantage of the latest features these offer, in turn avoiding potential compatibility issues
  2. Make sure you have provided the correct path in the "Path" property of the Python Scope activity. By default, the location is %LOCALAPPDATA%\Programs\Python\PythonXX\python.exe, where XX is the Python version used
  3. Be mindful that the "Version" property for the Python Scope would detect only Python versions above v3.5 if set to "Auto"
  4. Configure the "Library Path" apart from the other Input parameters. For example:

Library path (Linux or version>3.9) = python_dir+"\python310.dll"

Path = python_dir

Target = x64

Version Python >= 3.10

Where "python_dir" is the Python installation directory.

  • Try reinstalling Python and add the Python’s install directory to the system's "PATH" environment variable. If the installation has been done in a custom location than the previous installation, provide the updated path in the Python Scope. (Sample article for reference)
  • If a machine is present where the automation works as expected, check if there is any difference in the way the two machines (i.e. working and non-working) are configured. Also, compare the activity properties for the automation on both the instances.
  • Go to the folder: %userprofile%\.nuget\packages\uipath.python.activities\1.6.0\bin\net5.0, and from that folder, run the executable "UiPath.Python.Host.exe". After you execute this file, you should see the process in the process list and it shouldn’t exit.
    • If it works, then close the process and run the robot with the TaskManager open and check if the "UiPath.Python.Host" appears in the process list when you run the process.
    • If it ends, then there is an issue with the environment.
  • Check with your IT team if there are any group policies that might affect how the python.exe is executed.
  • If the issue still persists, collect the following for further analysis:
    • Studio logs or Robot Execution logs
    • Application Event logs from the Bot and Orchestrator machines
    • Process Monitor Logs