Last modified: Nov 24, 2025 By Alexander Williams

Install pyexcel in Python with pip and Virtualenv

Working with Excel files in Python is common. The pyexcel library makes this easy. It provides simple APIs for reading and writing spreadsheets.

This guide covers installation using pip and virtualenv. We will ensure a clean setup. This prevents conflicts between projects.

What is pyexcel?

pyexcel is a Python library. It lets you handle Excel files effortlessly. You can read, write, and manipulate data.

It supports various formats. These include xls, xlsx, and csv. The library is user-friendly for beginners.

Prerequisites

Before installing, ensure Python is on your system. You need Python 3.6 or higher. Check your Python version first.


python --version

Python 3.9.7

You also need pip. It is Python's package installer. Verify pip is available.


pip --version

pip 21.2.4 from /usr/local/lib/python3.9/site-packages/pip (python 3.9)

Installing pyexcel with pip

The simplest method uses pip. Open your terminal or command prompt. Run the installation command.


pip install pyexcel

This downloads pyexcel and its dependencies. Wait for the process to finish. You should see a success message.


Successfully installed pyexcel-0.7.0 pyexcel-io-0.6.5 ...

To confirm installation, check the installed version. Use the pip show command.


pip show pyexcel

Name: pyexcel
Version: 0.7.0
Summary: A wrapper library to read, manipulate and write data in various excel formats

Using Virtualenv for Installation

Virtualenv creates isolated Python environments. This is best practice. It keeps project dependencies separate.

First, install virtualenv using pip. Run the following command.


pip install virtualenv

Create a new directory for your project. Navigate into it.


mkdir my_project
cd my_project

Create a virtual environment inside the folder. Name it 'venv'.


virtualenv venv

Activate the virtual environment. On Windows, use this command.


venv\Scripts\activate

On macOS and Linux, use this instead.


source venv/bin/activate

Your prompt will change. It shows the environment is active. Now install pyexcel within this environment.


pip install pyexcel

The library is now available only in this environment. This avoids system-wide installation.

Verifying the Installation

Let's verify pyexcel works. Create a simple Python script. We will read an Excel file.

First, create a sample Excel file. Name it 'sample.xlsx'. Add some data to it.

Now, write a Python script. Name it 'test_pyexcel.py'.


import pyexcel as pe

# Read the Excel file
sheet = pe.get_sheet(file_name="sample.xlsx")

# Print the sheet content
print("Sheet content:")
for row in sheet:
    print(row)

Run the script from your terminal.


python test_pyexcel.py

You should see the data from your Excel file. The output will list each row.


Sheet content:
['Name', 'Age']
['Alice', 30]
['Bob', 25]

This confirms pyexcel is working correctly. You can now use it in your projects.

Common Installation Issues

Sometimes, you might face issues. Here are common problems and solutions.

Permission Errors

On Linux or macOS, you might get permission denied. Use sudo with pip. But this is not recommended.

Better to use virtualenv. It avoids system-wide changes.

Missing Dependencies

pyexcel requires other libraries. These are installed automatically. If not, install them manually.

For example, for xlsx files, install pyexcel-xlsx.


pip install pyexcel-xlsx

Outdated pip

An old pip version can cause issues. Upgrade pip first.


pip install --upgrade pip

Conclusion

Installing pyexcel is straightforward. Using pip is quick for global use. Virtualenv is better for project isolation.

Always verify the installation. Test with a simple script. This ensures everything works.

Now you can handle Excel files in Python easily. Explore pyexcel's features for your data tasks.