=====================
Managing environments
=====================

On the **Environments** page, the left column displays your environments. At the bottom of the environments list are the **Create**, **Clone**, **Import**, **Backup**, and **Remove** buttons.

.. thumbnail:: ../img/nav-env-labeled.png
   :align: center

Searching for an environment
============================

In the **Search Environments** box, enter all or part of an environment name to filter the environment list.

.. thumbnail:: ../img/nav-env-search.png
   :align: center

.. _navigator-create-environment:

Creating a new environment
==========================

#. At the bottom of the environments list, select **Create**.
#. In the Create new environment dialog, enter a descriptive name for the new environment.

   .. thumbnail:: ../img/nav-env-create.png
      :align: center

#. Select Python or R to set the package type for your environment.
#. Select a version for your Python or R installation.
#. Click **Create**.

Using an environment
====================

#. In the environments list, select the environment name to activate it.
#. Click the arrow button beside the environment name to open the activation options dropdown.

   .. thumbnail:: ../img/nav-env-use.png
      :align: center

#. Select one of the following options for opening the environment:
   Terminal, Python interpreter, IPython Console, or Jupyter Notebook.

   .. note::
      Some of these options may not be available if they were not
      installed in the environment.

Cloning an environment
======================

.. caution::

    Your base environment cannot be cloned in Anaconda Navigator, nor does Anaconda recommend cloning it with an alternative method, as attempting to clone your base environment will generate an incomplete clone and might cause errors in Navigator and/or conda.

#. Activate the environment you want to clone by selecting it from the environments list.
#. At the bottom of the environments list, click **Clone**.
#. Enter a descriptive name for the new environment.
#. Click **Clone**.

.. thumbnail:: ../img/nav-env-clone.png
   :align: center

.. _navigator-import-environment:

Importing an environment
========================

Environment creation information can be shared using a ``.yml``-formatted configuration file. If someone has given you an environment file that you want to use—for example ``shared-environment-file.yml``—and you have saved it to your computer, you can import it into Navigator. Furthermore, if you have backed up an environment either locally or to `Anaconda Cloud <https://anaconda.cloud/>`_, you can import it onto your local computer with Navigator.

.. thumbnail:: ../img/nav-env-import.png
    :align: center

.. tab-set::

    .. tab-item:: Importing from a file

        #. At the bottom of the environments list, select **Import**.
        #. Select **Local drive**.
        #. Click the |folder| folder in the **Local drive** section.
        #. Select the ``.yml`` environment file you want to import.
        #. Enter a descriptive name for the new environment, or use the existing name.

            .. note:: 
            
                Each environment name must be unique. To overwrite an environment with the same name, select the **Overwrite existing environment** checkbox.

        #. Click **Import**.

    .. tab-item:: Importing from Anaconda Cloud

        #. At the bottom of the environments list, select **Import**.
        #. |sign_in|, if necessary.
        #. Select **Anaconda Cloud**.
        #. Click the |folder| folder in the **Anaconda Cloud** section.

            .. tip::

                If you do not want to immediately create a new environment, click **Download environment file** and save the environment to your computer. Click **Cancel** twice to close the Import dialog when finished.

        #. Select the environment you want to import.
        #. Click **Select**.
        #. Enter a descriptive name for the new environment, or use the existing name.

           .. note::

              Each environment name must be unique. To overwrite an environment with the same name, select the **Overwrite existing environment** checkbox.

        #. Click **Import**.

Your newly imported environment appears in the environments list.

Backing up an environment
=========================

Backing up your environment to Anaconda Cloud protects it from hard drive failure and machine malfunctions, while local backups are valuable for rolling back conda to a previous state.

.. warning::

    Don't delete your environment backup when uninstalling and reinstalling Anaconda Distribution or Miniconda. If you do, you will not be able to import your existing environments into your new installation.

Activate the environment you want to back up by selecting it from the environments list. Then follow the instructions below to back up to a local file or to Anaconda Cloud.

.. thumbnail:: ../img/nav-env-backup.png
   :align: center

.. tab-set::

    .. tab-item:: Backing up locally

        #. At the bottom of the environments list, click **Backup**.
        #. Select **Local drive**.
        #. Click **Backup**.
        #. Enter a descriptive name for your environment's ``.yml`` file.

           .. note::

              Each environment name must be unique.

        #. Choose a place on your computer to save it.
        #. Click **Save**.

    .. tab-item:: Backing up to Anaconda Cloud

        .. note::

            You need an `Anaconda Cloud account <https://anaconda.cloud/sign-in>`_ to back up your environment to Anaconda Cloud.

        #. At the bottom of the environments list, click **Backup**.
        #. Select **Anaconda Cloud**. 
        #. Enter a descriptive name for the backup. By default, the environment name and current date is entered as the backup name.

            .. note::

               Each environment name must be unique. To overwrite an environment with the same name, check **Overwrite existing environment**.

        #. Click **Backup**.

Removing an environment
=======================

.. tab-set::

    .. tab-item:: Navigator

        #. In the environments list, select the environment you want to remove.
        #. At the bottom of the list, click **Remove**.

            .. note::

                Removing an environment in Navigator only removes your local copy. It will not remove or delete environments you have backed up to Anaconda Cloud.

            .. thumbnail:: ../img/nav-env-remove.png
                :align: center

    .. tab-item:: Anaconda Cloud

        #. In a browser, open `Anaconda Cloud <https://anaconda.cloud/>`_.
        #. Sign in using your email address and password.
        #. From your profile in the top-right corner, navigate to **Subscriptions**.
        #. Select the **Environments** page. 
        #. Select **Delete** in the row associated with the environment you want to remove.

            .. note::

                Removing an environment in Anaconda Cloud only removes it from Anaconda Cloud. It does not affect any local copies.

            .. thumbnail:: ../img/cloud-env-delete.png
                :align: center

Advanced environment management
===============================

Navigator provides a convenient graphical interface for managing conda environments, channels, and packages. If you're comfortable working with Anaconda prompt (or terminal on Linux or macOS), you can access additional, advanced management features. To learn more, see `Managing environments <https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html>`_ in the conda documentation.

.. |download-environment-file| image:: ../img/download-environment-file-icon.png

.. |folder| raw:: html

    <i class="fa-solid fa-folder"></i>

.. |sign_in| raw:: html

    <a href="https://auth.anaconda.cloud/ui/login/" target="_blank" rel="noreferrer noopener nofollow">Sign in to Anaconda Cloud</a>