.. _repo-getting-started:

===============
Getting started
===============

.. contents::
   :local:
   :depth: 1


Finding, downloading and installing packages
============================================

You do not need to have an Anaconda Repository account or be logged in to
search for, download, or install packages, notebooks,
environments or installers.

You do need an account to access :doc:`private packages
<tasks/pkgs/control-access>` without an :ref:`access token
<repo-glossary-token>` and to upload and share your own packages,
notebooks, environments and installers with others.

Searching for packages
----------------------

#. In the top Search box, type part or all of the name of a file you
   are searching for, and then press Enter.

#. Packages that match your search string are displayed. To see more
   information, click the package name.

.. figure:: /img/anaconda-repo-search.png

   ..

|

Refining your search results
----------------------------

You can filter search results using 3 filter controls:

* Type: All, conda only or PyPI only.

* Access: All, Public and/or Private---available only if you are
  logged in.

* Platform: All, Source, Linux-32, Linux-64, Noarch, OSX-64,
  Win-32 and Win-64.

NOTE: Source packages are source code only, not yet built for any
specific platform. Noarch packages are built to work on all
platforms.


Downloading and installing packages from Anaconda Repository
------------------------------------------------------------

You can download and install packages using
:doc:`Anaconda Navigator </anaconda/navigator/index>`, the graphical
user interface for Anaconda\ |reg|. Advanced users may prefer a
Terminal window or an Anaconda Prompt.

Using Navigator
^^^^^^^^^^^^^^^

Navigator is automatically installed when you install
Anaconda.

To download and install a package into its own environment:

#. Start Navigator by clicking its program icon on your desktop
   or in your programs menu.

#. Set up Navigator to search your local Repository:

   #. From the top menu bar, select Preferences.

   #. In the Anaconda API domain box, type the address of your
      local Repository:

      .. figure:: /img/anaconda-repo-local.png

         ..

      |

      NOTE: If your organization does not use HTTPS, use ``http``
      in the domain box and clear the Enable SSL verification
      checkbox.

      NOTE: If your organization uses subdomains, enter the
      address as ``https://api.<your-anaconda-repo>:8080``.
      Replace ``<your-anaconda-repo>`` with the name of your
      local Repository. If that does not work, contact your
      system administrator.

   #. Click the Apply button.

#. Sign Navigator into your local Anaconda Cloud---Repository---
   so you can search for packages marked as private:

   #. Click the top right Sign in to Anaconda Cloud button.

   #. Type your Repository username and password:

      .. figure:: /img/anaconda-repo-navigator-signin.png

         ..

      |

   #. Click the Login button.

#. On the **Environments** tab, in the far-right Search packages
   box, type the name of the desired package.

#. In the list to the left of Channels, select either Not
   installed or All, then click the Search button.

#. Select the checkbox of the package you want to install, then
   click the Apply button.

For more information, see the full Navigator documentation
:doc:`/anaconda/navigator/index`.

Using conda in a Terminal window or an Anaconda Prompt
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Conda is automatically installed when you install Anaconda.

To download and install a package into its own environment:

#. Locate a package on Anaconda Repository that you want to download, then
   click the package name.

   A detail page displays specific installation instructions
   for the current operating system.

#. Enter the command into your Terminal window or Anaconda Prompt.

   EXAMPLE: To download and install a package with conda::

     conda install -c USERNAME PACKAGE

   TIP: Conda expands ``USERNAME`` to a URL such as
   ``https://<your-anaconda-repo>/USERNAME``, based on the
   settings in the ``.condarc`` file.


.. _repo-getting-started-build-upload:

Building and uploading new packages
===================================

Building and uploading new packages is optional, and best suited for
advanced users who are comfortable using a Terminal application. It
requires the anaconda-client, which is easy to get if you have installed
Anaconda.

Use Terminal window or Anaconda Prompt to run the following command line commands.

#. To build and upload packages, first install the Anaconda Client CLI::

     conda install anaconda-client

#. Log into your Repository account::

     anaconda login

   At the prompt, enter your Repository username and password.

#. Choose the package you would like to build. For this example,
   you can download our public test package::

    git clone https://github.com/anaconda-platform/anaconda-client
    cd anaconda-client/example-packages/conda/

#. To build your test package, first install conda-build and
   turn off automatic Client uploading, then run the
   ``conda build`` command::

    conda install conda-build
    conda config --set anaconda_upload no
    conda build .

#. Find the path where the newly-built package was placed, so
   that you can use it in the next step::

    conda build . --output

#. Upload your test package to your Repository account::

    anaconda login
    anaconda upload /your/path/conda-package.tar.bz2

   NOTE: Replace ``/your/path/`` with the path you found in the
   previous step.

For more information, see :ref:`repo-conda-packages`.

Sharing notebooks
=================

To upload a notebook to Anaconda Repository with anaconda-client, open
Anaconda Prompt or Terminal and then enter::

  anaconda upload my-notebook.ipynb

NOTE: Replace ``my-notebook`` with the name of your notebook.


Viewing notebooks
=================

You can view an HTML version of your notebook in Anaconda Repository. Log into
your account, then from the drop-down menu of the view button, select Notebooks.
Click the name of the notebook you want to view.

You can also view an HTML version of your notebook directly from::

  http://<your-anaconda-repo>/USERNAME/my-notebook

NOTE: Replace ``<your-anaconda-repo>`` with your Repository
name, ``USERNAME`` with your username and ``my-notebook``
with the name of your notebook.

Anyone who has anaconda-client and access to Repository can
download your notebook. To download the notebook, open Anaconda
Prompt or Terminal and enter::

  anaconda download USERNAME/my-notebook


Sharing environments
====================

A `saved conda environment <http://conda.pydata.org/docs/using/envs.html>`_
can be uploaded to Anaconda Repository with the web interface or the
``conda env upload`` command.

To save the environment, run this command in an Anaconda Prompt or Terminal
window::

    conda env export -n my-environment -f my-environment.yml

To upload it with the web interface go to::

    https://<your-anaconda-repo>/<USERNAME>/environments

Then use the Upload button in the top right corner.

To upload it with the ``conda env upload`` command::

    conda env upload -f my-environment.yml

NOTE: Replace ``my-environment`` with the name of your
environment.

You can view a list of your uploaded environments at::

  http://envs.<your-anaconda-repo>/USERNAME

NOTE: Replace ``<your-anaconda-repo>`` with the name of your
local Repository and ``USERNAME`` with your username.

Anyone who has access can download and install your environment.
Open Anaconda Prompt or Terminal and then enter::

  conda env create user/my-environment
  source activate my-environment

NOTE: Replace ``user`` with your username and ``my-environment`` with
the name of your environment.

.. |reg|    unicode:: U+000AE .. REGISTERED SIGN
