Menu
Buy VPS
Dedicated Server
Payments
User

DropVPS Team

Writer: Cooper Reagan

How to Install pandas on Linux, macOS and Windows Server

How to Install pandas on Linux, macOS and Windows Server

Publication Date

Category

Articles

Reading Time

4 Min

Table of Contents

Create a Python virtual environment, activate it, and run python -m pip install pandas. On Debian 13 and Ubuntu 26.04 a plain pip install pandas fails with an externally-managed-environment error, so the virtual environment is not optional there.

python3 -m venv ~/venvs/data
source ~/venvs/data/bin/activate
python -m pip install pandas

Jump to your system

Why use a virtual environment

Modern Debian and Ubuntu releases mark the system Python as "externally managed". This stops pip from overwriting packages that the operating system itself depends on. A virtual environment gives pandas its own folder, so you can install, upgrade or delete it without touching the system.

A virtual environment also makes it easy to run several projects on one VPS with different pandas versions.

Debian 13 and Ubuntu 26.04

1. Install Python tools

sudo apt update
sudo apt install -y python3 python3-venv python3-pip

2. Create and activate a virtual environment

python3 -m venv ~/venvs/data
source ~/venvs/data/bin/activate

Your prompt now starts with (data). Every python and pip command you run in this terminal uses the virtual environment.

3. Install pandas

python -m pip install --upgrade pip
python -m pip install pandas

pip downloads a prebuilt package (a "wheel"), so you do not need a compiler.

Alternative: the Debian/Ubuntu package

If you only need pandas for system scripts and do not care about the newest version, you can install the distribution package instead:

sudo apt install -y python3-pandas

This version is older and is updated only with the operating system. For development work, use the virtual environment.

RHEL, AlmaLinux and Rocky Linux

sudo dnf install -y python3 python3-pip
python3 -m venv ~/venvs/data
source ~/venvs/data/bin/activate
python -m pip install --upgrade pip
python -m pip install pandas

macOS

Use the Python from Homebrew or from python.org. The Homebrew Python is also externally managed, so use a virtual environment here too.

brew install python
python3 -m venv ~/venvs/data
source ~/venvs/data/bin/activate
python -m pip install pandas

Windows Server 2025

1. Install Python

Download the Windows installer from python.org. On the first screen, tick Add python.exe to PATH, then click Install Now.

Open a new PowerShell window and check the install:

py --version

2. Create and activate a virtual environment

py -m venv C:\venvs\data
C:\venvs\data\Scripts\Activate.ps1

If PowerShell says that running scripts is disabled, allow local scripts for your user and try again:

Set-ExecutionPolicy -Scope CurrentUser RemoteSigned

3. Install pandas

python -m pip install --upgrade pip
python -m pip install pandas

Check that pandas works

Run this on any system, inside the activated virtual environment:

python -c "import pandas as pd; print(pd.__version__)"

It prints the installed pandas version. A quick real test:

python -c "import pandas as pd; df = pd.DataFrame({'server': ['web', 'db'], 'ram_gb': [2, 4]}); print(df)"

Troubleshooting

error: externally-managed-environment

You ran pip install pandas outside a virtual environment on Debian 13 or Ubuntu 26.04. Activate your virtual environment first (source ~/venvs/data/bin/activate) and run the command again. Do not use --break-system-packages on a server: it can break system tools that depend on Python.

ModuleNotFoundError: No module named 'pandas'

pandas is installed, but in a different Python. This usually means the virtual environment is not active in this terminal, or a script runs with the system Python. Activate the environment, or run the script with the environment's Python directly:

~/venvs/data/bin/python your_script.py

No module named pip or pip: command not found

Install pip for your system (sudo apt install python3-pip on Debian/Ubuntu) and always call it as python -m pip. See also: Fix "No module named pip".

pip tries to build pandas from source and fails

pip falls back to building from source when no prebuilt package exists for your Python version, usually because the Python version is very new or very old. Check the supported Python versions on the pandas installation page and use a supported one.

Run pandas jobs on a VPS

A VPS lets scheduled data jobs, such as nightly CSV reports, run without your own computer staying on. pandas works on any of our Linux VPS plans; for large datasets, choose a plan with enough RAM to hold your data in memory.

Windows VPS

Follow DropVPS on Google

Add DropVPS as a preferred source to see our latest VPS guides and tutorials surfaced first in Google Search and AI Overviews.

๐ŸชŸWindows VPS

Need a Windows Server?

DropVPS Windows VPS gives you full Admin RDP access, instant setup, and dedicated resources โ€” run any Windows workload without limits.

  • Full Admin Access
  • RDP Ready Instantly
  • Dedicated Resources
  • 24/7 Support
Get Windows VPS โ†’

No commitment ยท Cancel anytime

U
Loading...

Related Posts