Last modified: May 28, 2025 By Alexander Williams

How to Install Python Package with Conda

Conda is a powerful package manager for Python. It helps install and manage dependencies easily. This guide will show you how to install Python packages with Conda.

What is Conda?

Conda is an open-source package management system. It works for Python and other languages. It simplifies installing and managing libraries.

Conda is part of the Anaconda distribution. It handles dependencies efficiently. It is great for data science and machine learning projects.

Prerequisites

Before installing packages with Conda, ensure you have it installed. You can check by running:


conda --version

If Conda is not installed, download Anaconda or Miniconda from the official website.

Installing a Python Package with Conda

To install a package, use the conda install command. For example, to install NumPy:


conda install numpy

Conda will resolve dependencies and install the package. Confirm the installation by typing y when prompted.

Example: Installing Pandas

Let’s install Pandas, a popular data analysis library:


conda install pandas

Output:


The following packages will be installed:
  pandas, numpy, python-dateutil, pytz
Proceed ([y]/n)? y

Conda installs Pandas and its dependencies automatically.

Installing a Specific Version

You can specify a version of the package. Use the = symbol:


conda install numpy=1.21.0

This installs NumPy version 1.21.0.

Creating a Conda Environment

It’s good practice to use environments. They keep projects isolated. Create one with:


conda create --name myenv python=3.9

Activate the environment:


conda activate myenv

Now, install packages in this environment.

Listing Installed Packages

To see installed packages, use:


conda list

This displays all packages in the current environment.

Updating a Package

Update a package to the latest version:


conda update numpy

This updates NumPy to the newest version available.

Removing a Package

To uninstall a package, use:


conda remove numpy

This removes NumPy from the environment.

Using Conda vs. Other Methods

Conda is great for managing complex dependencies. For simpler projects, you might use requirements.txt or Poetry.

For installing from local files, check .tar.gz files or .whl files.

Common Issues and Fixes

Sometimes, Conda may fail to resolve dependencies. Try updating Conda first:


conda update conda

If a package is not available in Conda, use pip inside the environment.

Conclusion

Conda is a powerful tool for managing Python packages. It handles dependencies well and keeps environments clean. Follow this guide to install packages easily.

For more advanced setups, explore other methods like setup.py or local directory installations.