6.5 Conda Environment Best Practices

This section highlights the best practices for creating conda environments in OML4Py to prevent Python and third/fourth-party dependency conflicts.

Python Version

The current Python version being used, python=3.13.x, when creating a Conda environment for a 3rd-party package to avoid inconsistencies. To determine the latest Python version being used, run the following command:
import sys
sys.version

Note:

To prevent dependency conflicts, you can create a new environment and install all required packages simultaneously using the create command. This allows the solver to resolve all dependencies at once.

Admin Task: Create and Upload a Conda Environment

Use the create command to create a Conda environment named mypyenv to install the seaborn package. Specify the Python version using the python parameter. Use the upload command to upload the mypyenv environment to the Object Storage associated with the Autonomous AI Database instance for an OML user to download and use it.

Use the latest version of Python available in OML Notebooks; in this example, we are using Python 3.13.5.
%conda

create -n mypyenv -c conda-forge --override-channels --strict-channel-priority python=3.13.5 seaborn
upload mypyenv --overwrite -t application "OML4PY"

OML User: Use a Conda Enviroment

An OML user, you can download, activate, and use the environment in Python paragraphs in notebooks:
%conda

download mypyenv
activate mypyenv
Import the seaborn library:
%python

import seaborn