=================
Managing packages
=================

On the **Environments** page, the packages table in the right column lists the packages included in the environment selected in the left column.

.. note::
   Packages are managed separately for each environment. Changes you make to packages only apply to the active environment.

.. thumbnail:: ../img/nav-pkg-list.png
   :align: center

.. tip::
   The **Update Index** button refreshes the packages table with all packages that are available in any of the enabled channels.

Filtering the packages table
============================

By default, only installed packages are shown in the packages table. To filter the table to show different packages:

#. Click the dropdown beside **Channels**.
#. Select which types of packages to display.

.. note::
   Selecting the *Updatable* filter option lists packages that are installed and have updates available.

Searching for packages
======================

To search for a specific package, type all or part of the package's name into the **Search Packages** box.

The results of the search depend on:

* the channels added to Navigator,
* the selected package list filter option, and
* the environment selected, if searching for already-installed packages

If a package you are expecting doesn't appear in the search, make sure you have the correct filter option and environment selected. If the package is not available in the default channels, make sure the correct channels are added to your **Channels** list.

Installing a package
====================

#. Select the environment where you want to install the package.

   .. note::
      Anaconda does not recommend installing packages in your ``base`` environment.

#. Select the *Not Installed* filter option to list all packages that are available in the environment's channels, but not installed.

   .. note::
      Only packages that are compatible with your current environment are listed.

#. Use the **Search Packages** box to narrow the package options, if necessary.
#. Select the package you want to install.
#. Click **Apply**.

   .. thumbnail:: ../img/nav-search-install-pkgs.png
      :align: center

#. Review the **Install Packages** information. This dialog lists the packages chosen for installation and all dependencies of those packages that also need to be installed.

   You can sort the list of packages to be installed by the following information:

   Name
      The name of the package.

   Unlink
      The package version being uninstalled.

   Link
      The package version being installed.

   Channel
      The channel from which the package is being installed.

   Action
      The action being taken. In this case, "Install".

   .. thumbnail:: ../img/nav-install-pkgs.png
      :align: center

#. Click **Apply**.
   
   .. tip::
      If a new package doesn't appear in the packages table after you install it, select the **Home** page, then click **Refresh** to reload the packages table.

Confirming a package is installed correctly
===========================================

Once a package is installed, it appears in the Installed package list for the given environment, but another way to confirm that a package is installed correctly is by opening a Jupyter Notebook in that environment, importing the package, and displaying its help text. These instructions assume you created an environment named ``biopython`` and installed the BioPython package into it.

#. On the **Home** page, select the ``biopython`` environment from the environment dropdown.

#. Click **Install** on the Jupyter Notebook application tile to install it into the ``biopython`` environment.

#. Launch Jupyter Notebook from its application tile.

#. In the Jupyter Notebook, click **New** and select the Python 3 kernel.

   .. thumbnail:: ../img/select-python-version.png
      :align: center

#. Copy and paste the following code into the first cell:

   .. code-block:: none

      import Bio
      help(Bio)

#. To run the code, click **Run** or use the keyboard shortcut Ctrl+Enter (Windows)/Ctrl+Return (Mac).

#. The BioPython help text is displayed.

   .. thumbnail:: ../img/biopython-help.png
      :align: center

   .. note::
      To determine the import name of a package (such as ``Bio`` for BioPython), search the package's documentation.

Updating a package
==================

To mark packages for updating:

#. Select the *Updatable* filter option to list all installed packages that have updates available.
#. Select the blue arrow on the line(s) of the package(s) you want to update.
#. Click **Apply**.

   .. thumbnail:: ../img/nav-update-pkgs.gif
      :align: center

Installing a different package version
======================================

#. Select the checkbox beside the package whose version you want to change.
#. Select *Mark for specific version installation*. If other versions are available for this package, they are displayed in a list.

   .. thumbnail:: ../img/nav-version-update.gif
      :align: center

#. Select the package version you want to install.
#. Click **Apply**.

Removing a package
==================

#. Select the checkbox beside the package you want to remove.
#. Select *Mark for removal*.

   .. thumbnail:: ../img/nav-remove-pkg.gif
      :align: center

#. Click **Apply**.

Advanced package management
===========================

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