Webinar

November 3rd, 2021 12:00 PM EDT
Automation for Field Services & DistributionNovember 3rd, 2021 12:00 PM EDT
Learn how creating a digital workforce can improve your supply chain processes!

Adding packages to your robot

One of the Robocorp automation stack advantages is that you can benefit from the extensive ecosystem of Robot Framework libraries and freely available Python packages.

When you create a new project using our development tools, you will get a ready-to-go base environment. The environment will include the rpaframework package, giving you access to the RPA Framework set of open-source libraries supported and developed by Robocorp. You can add more features to your robot by adding more libraries and packages, or even remove the package if your code does not need it. Let's see how!

A small introduction: conda and pip

The Robocorp automation stack uses the conda open-source dependency management system to simplify the management of Python environments. Check the environment control page for more details.

As often happens in the open-source world, this is not the only solution available: another popular package management system for Python modules is pip. Conda is a newer initiative, so not all packages are available for both systems. For this reason, we decided to support both systems.

Should I use conda packages or pip packages?

Conda has a more efficient way to install packages and manage dependencies, which results in better and faster performance when setting up environments. So, if the library or module you are interested in is available as a conda package, we recommend going with it. As a general rule, only use the pip version of a package if it is not available in conda.

The conda.yaml file

The conda.yaml file (see default project structure) defines the environment your robot will run in. The default conda.yaml file you get when creating a new project looks something like this (comments added for clarity):

# Conda channels. We recommend using packages from the conda-forge channel.
channels:
  - conda-forge
dependencies:
  # Defining conda packages:
  - python=3.7.5
  # Adding pip itself as a conda package:
  - pip=20.1
  - pip:
      # Defining pip packages:
      - rpaframework==11.4.0

When given this configuration file, conda will:

  • use the conda-forge conda channel
  • install a specific version of Python (which is available as a conda package)
  • install a specific version of pip
  • install the rpaframework pip package, at version 11.4.0.

Note: we are at work to be able to distribute rpaframework as a conda package as well.

Where do I find packages?

Both systems provide web interfaces to search for supported packages:

How do I add new packages?

Once you found the package you want to use, add it to the correct section of the conda.yaml file. This can be done manually or automated using RCC, our command-line tool.

Adding conda packages

For example, if your robot requires the numpy package, which is available as a conda package, you can add it under the dependencies YAML attribute. In this case, we are specifying the latest version at the time of writing.

channels:
  - defaults
  - conda-forge
dependencies:
  - python=3.7.5
  - pip=20.1
  # Numpy added here:
  - numpy=1.20.3
  - pip:
      - rpaframework==11.4.0

You can achieve the same result using RCC and its robot libs command:

rcc robot libs --add numpy=1.20.3 --conda conda.yaml
  • Use the -add parameter to specify the name and version of the package.
  • Use the --conda parameter to specify the path to the conda.yaml file.

Adding pip packages

For example, if your robot requires the robotframework-datadriver Robot Framework library, which is only available as a pip package, you will have to add it under the pip attribute:

channels:
  - defaults
  - conda-forge
dependencies:
  - python=3.7.5
  - pip=20.1
  - pip:
      - rpaframework==11.4.0
      # robotframework-datadriver added here:
      - robotframework-datadriver==1.4.1

You can achieve the same result using RCC and its robot libs command:

rcc robot libs --pip --add robotframework-datadriver==1.4.1 --conda conda.yaml
  • Use the -add parameter to specify the name and version of the package.
  • Use the --conda parameter to specify the path to the conda.yaml file.
  • Use the --pip parameter to indicate that you want to install a pip package.
October 21, 2021