• Post author:
  • Post category:Pandas
  • Post last modified:March 27, 2024
  • Reading time:14 mins read
You are currently viewing Install Pandas on Linux & Mac OS

Before you proceed to install pandas package make sure you have Python or Anaconda installed and have set the environment variables to access python/pip/pip3 commands from the command line, shell, or terminal based on OS you are using.

Related: Install Anaconda & Run pandas on Jupyter Notebook

In order to check if pandas is already installed, use pip list command to get the list of the package installed. If you don’t have Pandas installed then this command doesn’t list it. You can also use pip3 list command if you have pip3 installed. if you already have Pandas installed but it is an old version, you can upgrade Pandas to the latest or to a specific version using python -m pip install --upgrade pip.

You can install the python pandas version either using PyPi & Conda.

PyPI is a Python package repository for third-party libraries, you can use the pip (Python package manager) command that comes with python to install third-party packages from PyPI. Using pip you can install/uninstall/upgrade/downgrade any python library that is part of Python Package Index. If your pip is not up to date, then upgrade pip to the latest version.

Conda is the package manager that the Anaconda distribution is built upon. It is a package manager that is both cross-platform and language agnostic (it can play a similar role to a pip and virtual environment combination).

1. Install pandas Using pip On Windows

As I said above you can install pandas to the latest version in different ways depending on how you have installed python, below I have explained using pip and conda commands on windows.

1.1 Installing from PyPi using pip Command

Before you use this, you need to have python installed. If you don’t have python installed then follow Install python pandas on windows


# Install pandas using pip
pip install pandas
(or)
pip3 install pandas

This should give you output as below. In case if you get 'pip' is not recognized as an internal or external command error, you need to set the python installed location to PATH.

Install pandas windows

To check what version of pandas installed use pip list or pip3 list commands.

show pandas installed version

1.2 Installing pandas using conda (Anaconda)

If you have Anaconda distribution installed to run pandas, then open the Anaconda command prompt and use conda install pandas to install Python pandas latest version. In case you get 'conda' is not recognized as an internal or external command error, you need to set the conda installed location to PATH.


# Install pandas using conda
conda install pandas

In case if you wanted to install a specific pandas version


# Install pandas to a specific version
conda install pandas=0.20.3

If you wanted to install pandas after creating the Conda environment then run the following commands


conda create -n env_name python
activate env_name
conda install pandas

2. Install pandas on Linux

On Linux, you can either use above mentioned commands pip & conda) or use the Linux distribution package manager to install python pandas, so depending on the flavor of Linux you are using the command would change.

2.2 Use apt-get on Ubuntu or Debian


# Install pandas using apt-get 
sudo apt-get install python3-pandas

I have to use sudo to run the above command as root.

2.3 Using yum on Centos/RHEL


# Install pandas using yum
yum install python3-pandas

On Linux distribution you may not find all pandas versions hence, the recommended approach would be using pip and conda.

3. Install pandas on Mac OS

On Mac OS, you can use either pip or conda to install pandas.


# Install pandas using pip or pip3
sudo pip install pandas
or
sudo pip3 install pandas

If you are not the root user then use sudo as by default python packages are installed in the system directory where you may not have permission to write files. If you wanted to install to a specific user then use --user option


pip install --user pandas

Frequently Asked Questions on Install Pandas on Linux & Mac OS

What is Pandas?

Pandas is an open-source data manipulation and analysis library for the Python programming language. It provides powerful data structures and functions to work with structured data, making it easier to clean, transform, and analyze data.

How do I install Pandas on Linux?

You can install Pandas on Linux using the Python package manager, pip. Open a terminal and run the following command: pip install pandas

Do I need administrative privileges to install Pandas?

If you are installing Pandas globally (for all users), you might need administrative privileges. You can use sudo on Linux or macOS to install packages globally: sudo pip install pandas

Can I install Pandas using a specific Python version?

If you have multiple Python versions installed on your system, you can specify the Python version when installing Pandas. For example, to install Pandas for Python 3, you can use pip3: pip3 install pandas

Are there alternative installation methods for Pandas?

Apart from using pip, you can also install Pandas using package managers like conda or from source. However, using pip is the most common and straightforward method.

Where can I find more information about Pandas?

You can find more information about Pandas, including documentation, tutorials, and community support, on the official Pandas website. Additionally, there are many online resources and books available for learning Pandas.

Conclusion

In this article, I have covered different ways to install python pandas on Windows, Linux, and Mac OS. It is recommended to use either pip or conda if you are using Anaconda distribution to install pandas.

Related Articles

Naveen Nelamali

Naveen Nelamali (NNK) is a Data Engineer with 20+ years of experience in transforming data into actionable insights. Over the years, He has honed his expertise in designing, implementing, and maintaining data pipelines with frameworks like Apache Spark, PySpark, Pandas, R, Hive and Machine Learning. Naveen journey in the field of data engineering has been a continuous learning, innovation, and a strong commitment to data integrity. In this blog, he shares his experiences with the data as he come across. Follow Naveen @ LinkedIn and Medium

Leave a Reply

This Post Has One Comment

  1. Nabil Mohammed Asif

    Very helpful. Thanks.