How-To: Using Anaconda - Install a Package in a Virtual Conda Environment via Command Line Interface

Question

How do I install a package in a virtual conda environment from the Command Line?

 

Answer

Note:  To activate an environment from the command line, see "How-To: Using Anaconda - Activate a Virtual Conda Environment via Command Line Interface"

1. From the Anaconda Prompt command line (CLI) in an active virtual conda environment, enter "conda list" to list installed packages.

Example environment: venv_3_13

command prompt window in venv_3_13 virtual environment with "conda list" as an example

 

2. Add new package.

a. Enter "conda install <package_name>". The below three screenshots show the output of installation of the example package.

Example package: pandas

b. A prompt to proceed will be displayed and require "y".

c. The new package is added.

Anaconda prompt with "conda install pandas" on command line

Anaconda Prompt with question to proceed with installation.

Anaconda Prompt with completion of package installation.

 

3. Enter "conda list" again to verify package was installed. Example package highlighted.

Example package: pandas

Anaconda Prompt with "conda list" and packages listed.

Print Article

Related Articles (9)

Install a Package in a Conda Environment in Anaconda Navigator
Install a PyPI Package with PIP in a Conda Environment via Command Line Interface
Install an R package from CRAN in a virtual conda environment using the command line interface.
Remove a Virtual Conda Environment via Command Line Interface
Remove a Package in a Conda Environment via Command Line Interface.
Update a Package in a Conda Environment via Command Line Interface
Conda channels act like specialized "app stores" or online libraries where you can find and download different software packages for your projects. This article explains how to choose between major stores like the curated Anaconda Defaults or the massive, community-run Conda-Forge. It also covers how to set a "priority" for these stores so your computer always knows which one to check first to keep your software stable and up-to-date.
Think of Conda as a way to create separate, private "workspaces" on your computer for different projects so their software settings don't get mixed up or cause errors. While other tools only handle one coding language, Conda is a "heavy hitter" that can manage almost any software component, making it the top choice for complex fields like Data Science and AI. By using these isolated spaces, you keep your computer stable and make it easy to share your exact setup with others.
Index of Miniconda How-To Articles for Virtual Conda Environments