

Amazon CodeCatalyst is no longer open to new customers. Existing customers can continue to use the service as normal. For more information, see [How to migrate from CodeCatalyst](migration.md).

# Configuring pip and installing Python packages
<a name="packages-python-pip"></a>

To use `pip` with CodeCatalyst, you must connect `pip` to your package repository and provide a personal access token for authentication. You can view instructions for connecting `pip` to your package repository in the CodeCatalyst console. After you authenticate and connect `pip` to CodeCatalyst, you can run `pip` commands.

**Contents**
+ [Installing Python packages from CodeCatalyst with pip](#pip-install)
+ [Consuming Python packages from PyPI through CodeCatalyst](#pip-install-pypi)
+ [pip command support](#pip-command-support)
  + [Supported commands that interact with a repository](#supported-pip-commands-that-interact-with-a-repository)
  + [Supported client-side commands](#supported-pip-client-side-commands)

## Installing Python packages from CodeCatalyst with pip
<a name="pip-install"></a>

The following instructions explain how to configure `pip` to install Python packages from your CodeCatalyst package repository or one of its upstream repositories.

**To configure and use `pip` to install Python packages from your CodeCatalyst package repository**

1. Open the CodeCatalyst console at [https://codecatalyst.aws/](https://codecatalyst.aws/).

1. On the overview page for your project, choose **Packages**.

1. Choose your package repository from the list of package repositories.

1. Choose **Connect to repository**.

1. In the **Connect to repository** dialog box, choose **pip** from the list of package manager clients.

1. You will need a personal access token (PAT) to authenticate pip with CodeCatalyst. If you already have one, you can use that. If not, you can create one here.

   1. Choose **Create token**.

   1. Choose **Copy** to copy your PAT.
**Warning**  
You will not be able to see or copy your PAT again after you close the dialog box.

1. Use the `pip config` command to set the CodeCatalyst registry URL and credentials. Replace the following values.
**Note**  
If copying from the console instructions, the following values should be updated for you and should not be changed.
   + Replace *username* with your CodeCatalyst user name.
   + Replace *PAT* with your CodeCatalyst PAT.
   + Replace *space\$1name* with your CodeCatalyst space name.
   + Replace *proj\$1name* with your CodeCatalyst project name.
   + Replace *repo\$1name* with your CodeCatalyst package repository name.

   ```
   pip config set global.index-url https://username:PAT@https://packages.region.codecatalyst.aws/pypi/space_name/proj_name/repo_name/simple/
   ```

1. Assuming that a package is present in your repository or one of its upstream repositories, you can install it with `pip install`. For example, use the following command to install the `requests` package.

   ```
   pip install requests
   ```

   Use the `-i` option to revert temporarily to installing packages from [https://pypi.org](https://pypi.org) instead of your CodeCatalyst package repository.

   ```
   pip install -i https://pypi.org/simple requests
   ```

## Consuming Python packages from PyPI through CodeCatalyst
<a name="pip-install-pypi"></a>

You can consume Python packages from the [Python Package Index (PyPI)](https://www.pypi.org/) through a CodeCatalyst repository by configuring the repository with an upstream connection to **PyPI**. Packages consumed from **PyPI** are ingested and stored in your CodeCatalyst repository.

**To consume packages from PyPI**

1. If you haven't already, configure pip with your CodeCatalyst package repository by following the steps in [Installing Python packages from CodeCatalyst with pip](#pip-install). 

1. Ensure that your repository has added **PyPI** as an upstream source. You can check which upstream sources are added or add **PyPI** as an upstream source by following the instructions in [Adding an upstream repository](packages-upstream-repositories-add.md) and choosing the **PyPI store** repository.

For more information about requesting packages from upstream repositories, see [Requesting a package version with upstream repositories](packages-upstream-repositories-request.md).

## pip command support
<a name="pip-command-support"></a>

The following sections summarize the pip commands that are supported, by CodeCatalyst repositories, in addition to specific commands that are not supported.

**Topics**
+ [Supported commands that interact with a repository](#supported-pip-commands-that-interact-with-a-repository)
+ [Supported client-side commands](#supported-pip-client-side-commands)

### Supported commands that interact with a repository
<a name="supported-pip-commands-that-interact-with-a-repository"></a>

This section lists `pip` commands where the `pip` client makes one or more requests to the registry it's been configured with. These commands have been verified to function correctly when invoked against a CodeCatalyst package repository.


****  

| Command | Description | 
| --- | --- | 
|   [install](https://pip.pypa.io/en/stable/reference/pip_install/)   |  Install packages.  | 
|   [download](https://pip.pypa.io/en/stable/reference/pip_download/)   |  Download packages.  | 

CodeCatalyst does not implement `pip search`. If you have configured `pip` with a CodeCatalyst package repository, running `pip search` will search and show packages from [PyPI](https://pypi.org/).

### Supported client-side commands
<a name="supported-pip-client-side-commands"></a>

These commands don't require any direct interaction with a repository, so CodeCatalyst does not need to do anything to support them.


****  

| Command | Description | 
| --- | --- | 
|   [uninstall](https://pip.pypa.io/en/stable/reference/pip_uninstall/)   |  Uninstall packages.  | 
|   [freeze](https://pip.pypa.io/en/stable/reference/pip_freeze/)   |  Output installed packages in requirements format.  | 
|   [list](https://pip.pypa.io/en/stable/reference/pip_list/)   |  List installed packages.  | 
|   [show](https://pip.pypa.io/en/stable/reference/pip_show/)   |  Show information about installed packages.  | 
|   [check](https://pip.pypa.io/en/stable/reference/pip_check/)   |  Verify that installed packages have compatible dependencies.  | 
|   [config](https://pip.pypa.io/en/stable/reference/pip_config/)   |  Manage local and global configuration.  | 
|   [wheel](https://pip.pypa.io/en/stable/reference/pip_wheel/)   |  Build wheels from your requirements.  | 
|   [hash](https://pip.pypa.io/en/stable/reference/pip_hash/)   |  Compute hashes of package archives.  | 
|   [completion](https://pip.pypa.io/en/stable/user_guide/#command-completion)   |  Helps with command completion.  | 
|   [debug](https://pip.pypa.io/en/stable/reference/pip_debug/)   |  Show information useful for debugging.  | 
|  help  |  Show help for commands.  | 