Create and Publish a Conda Environment

All administrative tasks for managing the Conda environment can be performed only by the ADMIN user.

The following example describes the steps to create a new Conda environment, install external Python packages, and persist the environment in internal storage. Note that these tasks can be performed only by the ADMIN user.
  1. Navigate to the Notebooks page and open a new notebook.
  2. Create a new Conda environment in a Conda paragraph.

    Tip:

    You can hover over the bottom part of a notebook paragraph and click the conda_icon Add Conda Paragraph icon to open a Conda paragraph instantly in the notebook.

    The following describes two choices for creating a new Conda environment. You can choose the option that applies to you:

    • To work with PyPGX APIs and other external Python packages, run the following command:
      %conda
      copy-local-env -n graphenv

      The following example creates a Conda environment, graphenv, by copying the basegraph environment:

      Description of conda_copy_env.png follows
      Description of the illustration conda_copy_env.png
    • To work with external Python packages only, create a Conda environment by running the following command:
      %conda
      create -n graphenv python==3.6.8

      The following example creates a Conda environment, graphenv, with the specified Python version:

      Description of conda_create_env.png follows
      Description of the illustration conda_create_env.png
  3. Install any third-party Python package in the newly created graphenv. For example, the following command installs the pandas 1.3.5 package in the graphenv.
    %conda
    install -n graphenv pandas=1.3.5
    Description of cond_install_pkg.png follows
    Description of the illustration cond_install_pkg.png

    As an ADMIN user, you can also choose to install a different Python version other than the one provided in the basegraph environment. For this, you must first activate the Conda environment created in the preceding step. Then you can uninstall the default Python library and install the required Python version as shown:

    activate <env_name>
    uninstall python
    install python=3.9
  4. Upload the Conda environment as shown:
    %conda
    upload graphenv --overwrite --description 'Conda environment with Pandas'
    Description of conda_upload_env.png follows
    Description of the illustration conda_upload_env.png
  5. Optionally, verify by listing all the uploaded environments as shown: