# Install third-party Python packages with pip

> Learn how to install third-party Python packages from PyPI using pip, from pip install to upgrading, pinning a version, uninstalling, and showing details.

Author: [Flavio Copes](https://flaviocopes.com/about/) | Published: 2021-02-01 | Updated: 2026-10-13 | Topics: [Python](https://flaviocopes.com/tags/python/) | Canonical: https://flaviocopes.com/python-pip/

To install a third-party Python package, you use `pip`, the package installer that ships with Python. You run `pip install` followed by the package name, and the package gets downloaded from PyPI and installed on your system.

The [Python standard library](https://flaviocopes.com/python-standard-library/) contains a huge number of utilities that simplify our [Python](https://flaviocopes.com/python-introduction/) development needs, but nothing can satisfy _everything_.

That's why individuals and companies create packages, and make them available as open source software for the entire community.

Those modules are all collected in a single place, the **Python Package Index** available at https://pypi.org, and they can be installed on your system using `pip`.

There are more than 270.000 packages freely available, at the time of writing.

> You should have `pip` already installed if you followed the [Python installation](https://flaviocopes.com/python-installation-macos/) instructions.

## How to install a package

Install any package using the command `pip install`:

```bash
pip install <package>
```

For example you can install the [`requests`](https://pypi.org/project/requests/) package, a popular HTTP library:

```bash
pip install requests
```

and once you do, it will be available for all your Python scripts, because packages are installed globally.

The exact location depends on your operating system.

On macOS, running Python 3.15, the location is `/Library/Frameworks/Python.framework/Versions/3.15/lib/python3.15/site-packages`.

## Upgrading, pinning, uninstalling

Upgrade a package to its latest version using the `-U` flag:

```bash
pip install -U requests
```

Sometimes you need a specific version, because the latest one breaks something or your project was tested against it. Install a specific version of a package using `==`:

```bash
pip install requests==2.34.2
```

Uninstall a package using:

```bash
pip uninstall requests
```

Show an installed package details, including version, documentation website and author information using:

```bash
pip show requests
```

This prints something like:

```
Name: requests
Version: 2.34.2
Summary: Python HTTP for Humans.
Home-page: https://requests.readthedocs.io
Author: Kenneth Reitz
Location: /Library/Frameworks/Python.framework/Versions/3.15/lib/python3.15/site-packages
```

The `Location` line is handy when you're not sure where pip put the package.

## When pip installs to the wrong Python

A common problem: you install a package, then Python says `ModuleNotFoundError` when you import it.

This usually happens when you have more than one Python version on your machine. The `pip` command in your PATH belongs to one interpreter, but you run your script with another.

The fix is to run pip through the interpreter you actually use:

```bash
python -m pip install requests
```

This guarantees the package lands in the `site-packages` folder of *that* Python, the one that will run your script.

My advice is to prefer `python -m pip` whenever you're in doubt. It removes the ambiguity entirely.

One more thing to keep in mind: installing everything globally works fine when you're learning, but different projects will eventually need different versions of the same package. When you get there, look into [virtual environments](https://flaviocopes.com/python-virtual-environments/), which give each project its own isolated set of packages.
