Edit

Share via


Install Python packages (CLI)

Azure DevOps Services | Azure DevOps Server 2022 - Azure DevOps Server 2019

This article guides you through installing Python packages from an Azure Artifacts feed using the NuGet command-line interface.

Prerequisites

Product Requirements
Azure DevOps - An Azure DevOps organization.
- An Azure DevOps project.
- Download and install Python.

Create a feed

  1. Sign in to your Azure DevOps organization and navigate to your project.

  2. Select Artifacts, and then select Create Feed.

  3. Provide a Name for your feed, choose the Visibility option that defines who can view your packages, check Include packages from common public sources if you want to include packages from sources like nuget.org or npmjs.com, and for Scope, decide whether the feed should be scoped to your project or the entire organization.

  4. Select Create when you're done.

    Screenshot that shows selections for creating a new feed in Azure DevOps Services.

  1. Sign in to your Azure DevOps server, and then go to your project.

  2. Select Artifacts, and then select Create Feed.

  3. Provide a Name for your feed, choose the Visibility option that defines who can view your packages, check Include packages from common public sources if you want to include packages from sources like nuget.org or npmjs.com, and for Scope, decide whether the feed should be scoped to your project or the entire organization.

  1. Select Create when you're done.

    Screenshot that shows selections for creating a new feed in Azure DevOps 2022.

  1. Select Create when you're done.

    Screenshot that shows selections for creating a new feed in Azure DevOps 2020.

Note

By default, the Build Service for the project (for example: projectName Build Service (orgName)) is assigned the Feed and Upstream Reader (Collaborator) role when a new feed is created.

Install packages

  1. Follow the steps in the Project setup to authenticated with your feed if you haven't done so, then proceed to the next step.

  2. Sign in to your Azure DevOps organization, and then navigate to your project.

  3. Select Artifacts, and then select Connect to feed.

  4. Select pip from the left navigation area. If this is your first time using Azure Artifacts with pip, make sure to install the prerequisites by selecting Get the tools and following the provided steps.

  5. Create a virtual environment.

  6. Add a pip.ini (Windows) or pip.conf (Mac/Linux) file to your virtualenv and paste the provided snippet into it. Your file should look similar to the following snippet:

    [global]
    index-url=https://pkgs.dev.azure.com/ORGANIZATION_NAME/PROJECT_NAME/_packaging/FEED_NAME/pypi/simple/
    
  7. Run this command in your project directory to install your packages:

    pip install
    

Important

You must have pip 19.2 or higher to use artifacts-keyring. See Usage requirements for more details.