Frequently Asked Questions (FAQ)¶
Q: Why am I getting a "Failed to prepare environment" error when deploying my python agent to UiPath Cloud Platform?¶
Error Message¶
{
"Code": "Serverless.PythonCodedAgent.PrepareEnvironmentError",
"Title": "Failed to prepare environment",
"Detail": "An error occurred while installing the package dependencies. Please try again. If the error persists, please contact support.",
"Category": "System",
"Status": null
}
Visual Example¶
Example of the error as it appears in UiPath Cloud Platform
Description¶
This error might occur when deploying coded-agents to UiPath Cloud Platform, even though the same project might work correctly in your local environment. The issue is often related to how Python packages are discovered and distributed during the cloud deployment process.
Common Causes¶
- Multiple top-level packages or modules in your project structure
- Improper configuration or formatting in the pyproject.toml or requirements.txt files
Solution¶
1. Check Your Project Structure¶
- Ensure your Python files are organized under a non top-level directory (e.g., using the
src
layout) - Follow the recommended project structure:
project_root/
├── src/
│ └── your_package/
│ ├── __init__.py
│ └── your_modules.py
├── pyproject.toml
└── setup.cfg/setup.py
2. Configure Package Discovery¶
If you need to maintain your current project structure, you can configure custom package discovery in your pyproject.toml
:
3. Verify Dependencies¶
- Ensure all required dependencies are properly listed in your
requirements.txt
orpyproject.toml
Reference¶
For more detailed information about package discovery and configuration, refer to the official setuptools documentation.
Note: This FAQ will be updated as new information becomes available. If you continue experiencing issues after following these solutions, please contact UiPath support.