============
Environments
============

An environment is a folder or directory that contains a specific collection of conda packages and their dependencies.

Working in separate environments allows you to maintain and run packages without interference from other collections of packages. For example, you may use one conda environment to maintain a Python 3 project and use another environment for R language projects.

.. _upload_env:

Uploading an environment file
=============================

#. `Create your environment.yml file <https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#create-env-file-manually>`_.
#. Log in to your instance of Package Security Manager.
#. Open a channel from the **Dashboard** or from the **My Channels** page.
#. Open the |gear| **Manage** dropdown menu and select *Upload File*.
#. Open the **Type** dropdown menu and select *Anaconda Environment*.
#. Click **Select files...** then locate and upload your environment file, or drag and drop the environment file into the field.
#. Click **Upload**.

Downloading an environment file
===============================

#. From the channel details page, select the **Environments** tab.
#. Select an environment, then click on an environment file to download it.

    .. thumbnail:: ../img/as_download_environment.png       
       :align: center

.. _view_enviro_dep:

Viewing environment dependencies
================================

#. From the channel details page, select the **Environments** tab.
#. Click on an environment, then select the **Dependencies** tab to view the packages your environment depends on.

   .. thumbnail:: ../img/as_view_environment_dependencies.png       
      :align: center

.. _view_env_meta:

Viewing environment metadata
============================

#. From the channel details page, select the **Environments** tab. 
#. Click on an environment.
#. Click |info-circle| **View more information** beside the ``.yml`` file to view its metadata.

   .. thumbnail:: ../img/as_environment_data.png
      :align: center

   You will be presented with the environment's metadata.

   .. thumbnail:: ../img/as_environment_metadata.png
      :align: center

Moving an environment file
==========================

To move an environment file from one channel or subchannel to another:

#. From the channel or subchannel details page, select the **Environments** tab. 
#. Select the checkbox beside the environment file you want to move. File management buttons appear at the top of the list.
#. Click **Move # Environments**. 
#. Open the **Move To:** dropdown menu and select a destination channel for your environment file. 
#. Click **Move**.

.. note:: 
    
    Moving an environment file will remove it from its origin channel. 

Copying an environment file
===========================

To copy an environment file from one channel or subchannel to another:

#. From the channel or subchannel details page, select the **Environments** tab. 
#. Select the checkbox beside the environment file you want to copy. File management buttons appear at the top of the list.
#. Click **Copy # Environments**.
#. Open the **Copy To:** dropdown menu and select a destination channel for your environment file. 
#. Click **Copy**.

.. note:: 
    
    Copying an environment file will not remove it from its origin channel. 

Deleting an environment file
============================

To delete an environment file from a channel or subchannel: 

#. From the channel or subchannel details page, select the **Environments** tab. 
#. Select the checkbox beside the environment file you want to copy. File management buttons appear at the top of the list.
#. Click **Delete # environments**.
#. Click **Delete** to verify you want to delete your selected environment file.

.. |gear| raw:: html

    <svg class="inline" xmlns="http://www.w3.org/2000/svg" height="20" width="20" viewBox="0 0 512 512"><path d="M211.6 28.5c1.6-7.3 8.1-12.5 15.6-12.5h57.6c7.5 0 14 5.2 15.6 12.5l12.9 57.1c.6 2.6 2.5 4.8 5 5.7c17.9 6.8 34.5 16.4 49.1 28.4c2.1 1.7 4.9 2.2 7.4 1.4l56-17.4c7.1-2.2 14.9 .8 18.6 7.3L478.3 161c3.7 6.5 2.5 14.7-3 19.8l-43.1 39.8c-2 1.8-2.9 4.5-2.5 7.2c1.5 9.2 2.3 18.7 2.3 28.4s-.8 19.1-2.3 28.4c-.4 2.6 .5 5.3 2.5 7.2l43.1 39.8c5.5 5.1 6.7 13.3 3 19.8L449.4 401c-3.7 6.5-11.5 9.5-18.6 7.3l-56-17.4c-2.6-.8-5.4-.3-7.4 1.4c-14.6 11.9-31.2 21.6-49.1 28.4c-2.5 1-4.4 3.1-5 5.7l-12.9 57.1c-1.6 7.3-8.1 12.5-15.6 12.5H227.2c-7.5 0-14-5.2-15.6-12.5l-12.9-57.1c-.6-2.6-2.5-4.8-5-5.7c-17.9-6.8-34.5-16.4-49.1-28.4c-2.1-1.7-4.9-2.2-7.4-1.4l-56 17.4c-7.1 2.2-14.9-.8-18.6-7.3L33.7 351c-3.7-6.5-2.5-14.7 3-19.8l43.1-39.8c2-1.8 2.9-4.5 2.5-7.2C80.8 275.1 80 265.7 80 256s.8-19.1 2.3-28.4c.4-2.6-.5-5.3-2.5-7.2L36.7 180.7c-5.5-5.1-6.7-13.3-3-19.8L62.6 111c3.7-6.5 11.5-9.5 18.6-7.3l2.4-7.6-2.4 7.6 56 17.4c2.6 .8 5.4 .3 7.4-1.4c14.6-12 31.2-21.6 49.1-28.4c2.5-1 4.4-3.1 5-5.7l12.9-57.1zM227.2 0c-15 0-27.9 10.4-31.2 25L184 78c-16.7 6.8-32.2 15.8-46.1 26.7L85.9 88.5C71.6 84 56.2 90.1 48.7 103L19.9 153c-7.5 13-5 29.4 6 39.5l39.9 36.9C64.6 238.1 64 247 64 256s.6 17.9 1.8 26.6L25.9 319.5l5.4 5.9-5.4-5.9c-11 10.1-13.5 26.6-6 39.5L48.7 409c7.5 13 22.9 19 37.2 14.6l51.9-16.2c14 10.9 29.5 19.9 46.1 26.7l12 53c3.3 14.6 16.3 25 31.2 25h57.6c15 0 27.9-10.4 31.2-25l12-53c16.7-6.7 32.2-15.8 46.1-26.7l51.9 16.2c14.3 4.4 29.7-1.6 37.2-14.6L492.1 359c7.5-13 5-29.4-6-39.5l-39.9-36.9c1.2-8.7 1.8-17.6 1.8-26.6s-.6-17.9-1.8-26.6l39.9-36.9c11-10.1 13.5-26.6 6-39.5L463.3 103c-7.5-13-22.9-19-37.2-14.6l-51.9 16.2C360.2 93.7 344.7 84.7 328 78L316 25c-3.3-14.6-16.3-25-31.2-25H227.2zM192 256a64 64 0 1 1 128 0 64 64 0 1 1 -128 0zm144 0a80 80 0 1 0 -160 0 80 80 0 1 0 160 0z"/></svg>

.. |info-circle| raw:: html

      <svg class="inline" xmlns="http://www.w3.org/2000/svg" height="18" width="18" viewBox="0 0 512 512"><path d="M256 32a224 224 0 1 1 0 448 224 224 0 1 1 0-448zm0 480A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM208 352c-8.8 0-16 7.2-16 16s7.2 16 16 16h96c8.8 0 16-7.2 16-16s-7.2-16-16-16H272V240c0-8.8-7.2-16-16-16H216c-8.8 0-16 7.2-16 16s7.2 16 16 16h24v96H208zm48-168a24 24 0 1 0 0-48 24 24 0 1 0 0 48z"/></svg>
