C3 AI Documentation Home

Create a Custom Runtime with Native Python Packages

You can create custom a runtime using native Python packages. You might want to create a custom runtime to define your own libraries and versions, specify configurations or optimizations, or integrate with C3 AI workflows.

There are two ways you can create custom a runtime using native Python packages:

  • Use conda. C3 AI recommends this method, because it is easier to manage dependencies and versions.
  • Create a .whl file.

Create a custom runtime with native Python conda packages

Here is an example of how to create a custom runtime using a C3 AI package called projecta and a native Python package called projecta.

  1. Create a local conda channel that contains the native Python package projecta. See the conda-build documentation.

  2. Store the local conda channel that contains the native Python package projecta inside the C3 AI package projecta in the resource folder.

    local conda channel

  3. Use the package path of the local conda channel to create a custom runtime called py-projecta in the Jupyter runtime management UI.

    Jupyter Runtime Management UI

    The custom runtime py-projecta now contains the native Python package projecta.

  4. Save the runtime.

Create a custom runtime with native Python conda package that depends on another package

Suppose you have a C3 AI package called projectb and a native Python package called projectb. The native Python package projectb depends on the native Python package projecta. The C3 AI package projectb depends on the native Python package projecta.

Here is an example of how to create a custom runtime:

  1. Prepare a C3 AI package .json file with a projecta dependency:

    JSON
    {
      "author": "John.Doe@c3.ai",
      "name": "projectb",
      "version": "0.1.0",
      "dependencies": { 
        "projecta" : "0.1.0"
      },
      "description": "Contains native python code for projectb"
    }
  2. Use the local conda channel that contains native Python package projectb to create a custom runtime for the C3 AI package projectb.

    The C3 AI package projectb now contains the native Python package projectb.

  3. Store the local conda channel that contains the native Python package projectb inside the C3 AI package projectb in the resource folder.

    Project B

  4. Use the local conda channel to create a custom runtime called py-projectb in the Jupyter runtime management UI. py-projecta is the parent runtime.

    Jupyter Runtime Management UI Project B

  5. Save the runtime.

Create a custom runtime with native Python .whl file

Alternatively, you can create a custom runtime by creating a .whl file for the native Python package. Use this .whl file in the runtime definition.

Here is an example of how to create a custom runtime using projecta as an example C3 AI package and native Python package:

  1. Create a .whl file for the native Python package. See PEP 491 – The Wheel Binary Package Format 1.9 to learn more about creating a .whl file.

  2. Store the .whl file in the C3 AI package projecta in the resource folder.

Project A Whl

  1. Use the package path of the .whl file as the URL for the pip package projecta to create a custom runtime called py-projecta in the Jupyter runtime management UI for projecta.

Jupyter Runtime Management UI Project A Whl

Was this page helpful?