Using Python Dependencies

Dis.co provides a default docker image with only Python 3.6 installed. You can have additional packages installed in your docker image by using either of the following methods.

Method 1: Send your job from your Python virtual environment using the Dis.co's CLI, SDK, or discomp. Dis.co takes all the Python packages that were installed in your virtual environment and installs them on the docker, then uploads it to the machine that will run the job.

To enable:

  1. Install the Python virtual environment.

  2. Activate it.

  3. Install all your Python dependencies in that environment.

  4. From your Python virtual environment directory, create a new job using Dis.co CLI, discomp or SDK.

    Your virtual environment will be frozen.

    Dis.co saves the Python package dependencies to a requirements.txt file that will be attached to your job as a constant file. These requirements will then be installed to your docker image before executing the job.

    Notes:

    • If your virtual environment contains no dependencies, a file will not be created.

    • The following warning message will be displayed when adding a job outside of a virtual environment:

      Python virtual environment was not detected. disco will not be able to automatically update your cloud environment when not using Python’s virtual environment.

Method 2: Create a requirement.txt with all your dependencies and upload it as a constant file with your job.

  • Through the UI: When creating the job, click the Advanced files tab and add the requirements.txt file.

  • Through the CLI: run the disco add command using the -constants flag and specify the requirements.txt file.