Manage centrally Python virtualenv/modules for robots

Hi there,
You have nice activities that allow using Python scripts. But they need modules (imported) and we require for the moment to install them on every machine the robot will run.
Therefore, it might be nice to have a centrally way (like UiPath packages dependency) to manage the modules used in python.

Example: you have Process A with python script that uses numpy, Process B with py script with PIL. When you start for the first time these processes, you would expect UiPath robot to install the modules in its directory (like .nuget\packages) with the correct version and your activity Python Scope will automatically ‘load’ these modules and consider them as installed.

What do you think?

Hi @yrobert and thanks for the suggestion! Unfortunately, that’s not how the UiPath-Python connection is made.

The Robot is unaware of exactly what Python does, it’s agnostic of how it functions behind the scenes. This decoupling has the advantage of making it extremely easy to set up the activity, without having to know much about the system hosting Python in advance.

Why not set up a small bootstrap/provisioning PowerShell script which makes sure you have all Python dependencies installed before running your Python script?

Hello @yrobert

You can provide a requirements file with your project and update your execution environments with pip. You might prefer sharing the same requirements file for multiple environments by putting it into a shared folder, in a repository, etc.

If your requirements file is at mydir/requirements.txt use the following command:

pip install -U -r mydir/requirements.txt

Hi @Tudor_Sandu and @msan , thank you for your answers and suggestions.

yes a small scripts is a good workaround. but I still consider it as a workaround and not a great solution.
If some processes have requirements that are not compatible, I don’t see how to make it work without environments (or having to put these processes on another robot with other machine/virtual desktop)
Or should we uninstall all dependencies after the process ran each time…?

Here’s a somewhat forced analogy…

Let’s assume you want to use Start Process to start OneNote. Start Process does not know what OneNote is (except that it’s an executable file). Do you expect the activity to install OneNote if it’s not already installed on that machine?

You’re right. Probably the best way is that the robot works with powershell or the command to prompt to set up his environment !