Work with Preinstalled Conda Environments

As a graph user, you can download and activate a preinstalled Conda environment.

You can then access the activated environment in a Python(PGX) paragraph. The following example describes the steps for a graph user to work with a preinstalled Conda environment.
  1. Navigate to the Notebooks page and open a new notebook.
  2. List all the available preinstalled Conda environments:
  3. Download the required Conda environment.

    The following example downloads the saved graphenv:

    %conda
    download graphenv

    Description of conda_download_env.png follows
    Description of the illustration conda_download_env.png

    Note the following:

    • If a Conda environment with the same name is already downloaded, then you can overwrite the environment as shown:
      download <env_name> --overwrite
    • You can download multiple Conda environments and can always switch between your environments by using the Conda activate <env> command.
    • If the environment download exceeds the maximum local storage limit of 8 GB, then the Conda interpreter throws an error. In such a case, you can remove an environment from the local storage, using the following command, and repeat the download operation:
      env remove -n <env_name>
  4. Activate the required environment.
    %conda
    activate graphenv

    Description of conda_activate_env.png follows
    Description of the illustration conda_activate_env.png

    When you activate a specific Conda environment, the earlier active environment is automatically deactivated. Therefore, when you are working with multiple environments, it is recommended that you activate the required environment before switching to another.

  5. Access the environment in a Python(PGX) paragraph.
    As a prerequisite, perform the following steps:
    • Run the Conda info or env list command and verify that you have activated the required environment. If not, run the Conda activate command, as described in the preceding step, to activate the required environment.
    • Run the Conda list command to verify that the activated environment contains the required packages that you need to access in the Python(PGX) paragraph.
    • This step applies only if you want to work with the PyPGX APIs. Verify that the output of the Conda list command shows the oracle-pypgx-client package. If this package is not available in the activated environment, then you cannot work using the PyPGX APIs. See step-2 in Create and Publish a Conda Environment for more information.
    Once you have verified the active environment and the packages installed in the active environment, then you can access the environment in the Python(PGX) paragraph. For instance, the following example uses the pandas package in the activated conda environment to convert a PGQL result set into Pandas dataframe.

    Description of conda_python_para.png follows
    Description of the illustration conda_python_para.png