A very common error when executing automations through the Runner is Python Environment Preparation Failed.
As the name suggests, the Runner fails when trying to prepare the Python environment for the robot's execution.
This error occurs in different situations and prevents the Runner from running the robot.
Below are some scenarios and approaches on how to handle this error:
In some cases of environment restrictions, when running an automation via Runner, the following error may be thrown::
exec: C:\\Botcity\\.\\venvs\\SAP/Scripts/python -m pip install --upgrade pip
Requirement already satisfied: pip in c:\\botcity\\venvs\\sap\\lib\\site-packages (23.2.1)
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/pip/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/pip/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/pip/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/pip/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/pip/
.....
Python environment preparation failed.
Error executing task: Python environment preparation failed....
Based on the error message, it appears that the environment where the Runner is being used cannot establish a connection with PyPI (Python Package Index).
As a result, the Runner cannot execute the pip install
command to install necessary packages.
This is common in corporate environments that have network restrictions, likely blocking communication with PyPI.
Please check with your infrastructure team if there is any blocking in place.
Here is documentation outlining the necessary network permissions for these cases:
https://documentation.botcity.dev/getting-started/prerequisites/#problems-with-blocking-environments
Log Screen Process created
Log Application Process created
WAITING NEW TASKS...
Executing task: Bot_LoginSAP...
exec: python -m venv ./venvs/Bot_LoginSAP_I
execAndWait - Error: Cannot invoke "java.lang.Process.waitFor()" because "this.process" is null
Since the error occurred after trying to create the virtual environment, the issue is likely related to Python itself, such as:
Python is not properly installed.
Python is not included in the system path.
The virtualenv
package is not installed.
To verify Python installation, you can run the commands:
python --version
where python
If you receive a valid Python version output from these commands, ensure the following packages are installed:
pip
virtualenv
The easiest way to ensure everything is set up is by running:
In some cases, Python cannot be found when running automation through the Runner.
To confirm that Python is installed on the environment, you can use:
python --version
where python
In some environments, there may be two versions of Python installed. It is common for them to be accessed through different commands. You can check by running:
py
python
If the desired version is being accessed through the py
command, and you want the Runner to use it for environment preparation, you must add the following line to the Runner's configuration file (conf.bcf
located inside the conf
folder of the BotCity SDK):
Alternatively, you can specify the full path to the desired Python executable by setting the pythonBinary
flag like this:
\\
) in the path to prevent single backslashes from being interpreted as escape characters during execution