Publishing a Conda Environment to an Object Storage Bucket in a Tenancy

Publish conda environments to Object Storage for use notebook sessions.

Before you can publish a conda environment or install a published conda environment, you need to configure odsc conda to use an Object Storage bucket using this command:

odsc conda init -b <your-bucket-name> -n <your-tenancy-namespace> -a <api_key or resource_principal>
Change these values in the command:
  • <your-bucket-name>: is the name of the Object Storage bucket in a tenancy containing Published Conda Environments.

  • <your-tenancy-namespace>: is the namespace of the tenancy.

  • <api_key or resource_principal>: provide either an API key or a resource principal. If you are using the API key option, you must have a valid API keys configuration. The default directory for the key is /home/datascience/.oci. If you want to use an alternate directory for API key, run the odsc conda init -a command and specify either an api_key or resource_principal name.

    You can run odsc conda init -h for more information about the options.

You only need to run the odsc conda init command one time per notebook session. Bucket and namespace values persist through deactivation and activation of a notebook session.

You can publish a conda environment that you have installed in a notebook session. Publishing a conda environment consists of creating a pack of a conda environment and uploading it to a specified Object Storage. This allows conda environments to be shared among colleagues or to persist them across notebook sessions. We recommend that you publish conda environments to ensure that a model training environment can be reproduced.

You can publish a conda by clicking Publish in an installed environment card. Copy the code snippet, and then run it in a terminal window tab:

odsc conda publish -s <slug>

The <slug> is the slug of the environment you want to publish.

List all of the supported install options with odsc conda install -h.

Conda environments can be published directly to an Object Storage bucket by specifying the --uri option. The authentication type is specified with the -a option. Some publish examples are:

Publishing the onnx110_p38_cpu_v2 conda environment after configuring with odsc conda by odsc conda init:
odsc conda publish -s onnx110_p38_cpu_v2
Publishing the database_p37_cpu_v2 conda environment to a bucket:
odsc conda publish -s database_p37_cpu_v2 --uri oci://<my-bucket>@<my-namespace>/prefix/

The environment is saved to oci://<my-bucket>@<my-namespace>/prefix/ using a resource principal by default.

Publishing the onnx110_p38_cpu_v2 conda environment to a bucket using api_key authentication:
odsc conda publish -s onnx110_p38_cpu_v2 --uri oci://<my-bucket>@<my-namespace>/ -a api_key

When no prefix is specified for --uri, conda_environment is specified as the default prefix. In this example, onnx110_p38_cpu_v2 is saved to the oci://<my-bucket>@<my-namespace>/conda_environment.

Important

ADS warns you when you create the model artifact to publish a conda environment before saving the model to the model catalog. If you have already published the conda environment, you can provide ADS with the path on Object Storage to that conda environment when you save the model. References to training environments are stored in the runtime.yaml file that's part of the model artifact, see managing models.