How to Install pandas in Python: PyPI, Conda, and Source Builds

You can install pandas in Python using pip install pandas for PyPI, conda install -c conda-forge pandas for Conda environments, or by building from source using python -m pip install . after installing build dependencies from requirements-dev.txt.

The pandas library provides high-performance data structures for data analysis in Python. According to the pandas-dev/pandas repository, the installation method you choose depends on whether you need a stable release for production work or the latest development version for contributing to the project. The official installation instructions are documented in the repository's README.md at line 108 and the detailed guide in doc/source/getting_started/install.rst.

Install pandas from PyPI using pip

The most common way to install pandas in Python is via pip, Python's standard package manager. This method pulls pre-compiled wheels from PyPI that already contain the C extensions responsible for pandas' performance, eliminating the need for a local C compiler.

This approach works across Windows, macOS, and Linux, and is ideal for virtual environments, Docker containers, and Jupyter notebooks:


# Install the latest stable release in a Jupyter notebook

!pip install pandas

For system-wide installations or specific virtual environments, run the command in your terminal:

pip install pandas

Install pandas using Conda (conda-forge)

If you use the Conda package manager (via Anaconda or Miniconda), installing from the conda-forge channel is preferred. This method automatically resolves binary dependencies such as NumPy and Cython, handling compiled dependencies without requiring a C toolchain on your system.

Run this command in your terminal:

conda install -c conda-forge pandas

Conda-forge provides binaries built for a wide range of platforms, making this method particularly robust for complex scientific computing environments where multiple compiled libraries interact.

Build and Install pandas from Source

Building from source is necessary when you want to contribute to the pandas-dev/pandas repository, need a custom build with specific patches, or require the absolute latest unreleased changes. This process runs the Cython compilation step and links against your system's C toolchain as defined in setup.py.

First, install the build requirements listed in requirements-dev.txt and ensure Cython is available, then use pip to build and install:


# Clone the repository

git clone https://github.com/pandas-dev/pandas.git
cd pandas

# Install build requirements including Cython

python -m pip install -r requirements-dev.txt
python -m pip install Cython

# Build and install using pip (recommended over legacy setup.py)

python -m pip install .

The legacy setup.py script in the repository root defines package metadata and extension modules, but modern Python packaging standards recommend using pip for the final installation step even when building from source, bypassing direct invocation of setup.py.

Verify Your pandas Installation

After installation, confirm that pandas is available and check the version by running this sanity check:

import pandas as pd

print(pd.__version__)  # e.g., 2.2.2

# Create a simple DataFrame to verify functionality

df = pd.DataFrame({"a": [1, 2], "b": [3, 4]})
print(df)

Summary

  • PyPI (pip) provides the quickest install using pip install pandas and works across all major operating systems by downloading pre-compiled wheels containing optimized C extensions.
  • Conda (conda-forge) offers the most reliable dependency resolution for scientific Python stacks using conda install -c conda-forge pandas, automatically managing binary dependencies like NumPy.
  • Source builds require cloning the pandas-dev/pandas repository, installing dependencies from requirements-dev.txt, and running python -m pip install . to compile the Cython extensions manually against your system's C toolchain.
  • Key repository files governing installation include setup.py for build configuration, requirements-dev.txt for development dependencies, and doc/source/getting_started/install.rst for the official documentation.

Frequently Asked Questions

What is the difference between installing pandas with pip versus conda?

Pip installs Python packages from PyPI and works with pre-compiled wheels that include pandas' C extensions, requiring you to manage system-level dependencies manually. Conda installs from the conda-forge channel and automatically handles binary dependencies like NumPy and Cython, making it preferable for data science environments where multiple compiled libraries must interact correctly.

How do I install pandas from source for development contributions?

To install pandas from source when contributing to the pandas-dev/pandas repository, clone the repository, install build requirements using python -m pip install -r requirements-dev.txt, install Cython separately, then run python -m pip install . to build the extension modules. This compiles the Cython source code against your local C compiler as configured in setup.py.

What are the build requirements for compiling pandas from source?

Building pandas from source requires the dependencies listed in requirements-dev.txt plus Cython to compile the .pyx extension modules into C code. You will also need a working C compiler toolchain (such as GCC on Linux, Xcode on macOS, or MSVC on Windows) to link the compiled extensions, as specified in the repository's build configuration.

Can I install pandas in a Jupyter notebook?

Yes, you can install pandas directly in a Jupyter notebook cell using !pip install pandas for PyPI installations or !conda install -c conda-forge pandas -y for Conda environments. After installation, restart the kernel and run import pandas as pd to verify the package loads correctly and the version matches your expectations.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s https://instagit.com/install.md

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client