Last modified: Oct 01, 2026

Fix pip install Timeout Error

The pip install timeout error is one of the most common problems Python developers face. It usually appears when pip cannot download a package fast enough.

The error stops your installation and leaves you frustrated. The good news is that this problem is easy to fix. You just need to know the right commands.

This guide explains why the timeout happens. It also shows you several practical ways to solve it. You can use these fixes on Windows, macOS, and Linux.

What Causes the pip Timeout Error?

Pip downloads packages from the Python Package Index (PyPI). This is a remote server on the internet.

By default, pip waits only 15 seconds for a connection. If the server does not respond in time, pip stops and throws a timeout error.

Several things can cause this delay. A slow internet connection is the most common reason. A large package like TensorFlow or PyTorch can also take longer than 15 seconds.

Other causes include a firewall, a proxy server, or a busy PyPI mirror. Sometimes your network is fine but the default server is just slow.

Here is what the error typically looks like:


ERROR: Exception:
Traceback (most recent call last):
  ...
socket.timeout: The read operation timed out

Now let's look at how to fix it step by step.

Fix 1: Increase the Timeout Value

The simplest fix is to give pip more time. Use the --timeout option. This sets the number of seconds pip waits before giving up.

Try a value like 60 or 120 seconds. This works well for slow connections.


# Increase the timeout to 120 seconds
pip install requests --timeout 120

If the install succeeds, you have solved the problem. If it still fails, move to the next fix.

Fix 2: Increase the Number of Retries

Sometimes the connection drops for a moment. Pip can retry automatically. Use the --retries option to set how many times pip tries again.

A value like 5 or 10 is a good choice. This helps when the network is unstable.


# Retry up to 10 times if the connection fails
pip install numpy --timeout 120 --retries 10

Combining both options gives you the best chance of success.

Fix 3: Use a Faster Mirror

PyPI can be slow in some regions. A local mirror is often much faster. Many countries have their own package mirrors.

Use the --index-url option to point pip to a different server. The example below uses a popular mirror.


# Use a faster mirror to download packages
pip install pandas --index-url https://pypi.org/simple --timeout 60

You can also set a mirror as the default. This saves you from typing the flag every time.

Fix 4: Check Your Proxy and Firewall

A company firewall or proxy can block pip. This causes the connection to hang and time out.

If you use a proxy, tell pip about it. Use the --proxy option with your proxy address.


# Route pip traffic through a proxy server
pip install flask --proxy http://user:[email protected]:8080

Make sure the proxy address and port are correct. Ask your network admin if you are unsure.

You may also need to whitelist pypi.org and files.pythonhosted.org in your firewall.

Fix 5: Upgrade pip Itself

An old version of pip can have bugs. These bugs may cause timeout errors. Upgrading pip often fixes the issue.

Run the command below to get the latest version.


# Upgrade pip to the newest version
python -m pip install --upgrade pip

After the upgrade, try your original install command again.

Fix 6: Use a Configuration File

Typing flags every time is annoying. You can save your settings in a pip config file.

Create a file called pip.ini on Windows or pip.conf on macOS and Linux. Add your timeout and mirror settings there.


# Example pip.conf content
[global]
timeout = 120
retries = 10
index-url = https://pypi.org/simple

Now every pip command uses these values by default. This is a clean and permanent solution.

Fix 7: Download the Package Manually

Sometimes the network is just too slow. In that case, download the package file yourself.

Go to pypi.org in your browser. Find the package and download the .whl file.

Then install it from your local folder. This avoids the network entirely.


# Install a package from a local wheel file
pip install ./downloads/requests-2.31.0-py3-none-any.whl

This method always works when the internet is the problem.

Quick Checklist

Before you try complex fixes, run through this short list.

First, check your internet connection. Second, try the --timeout flag. Third, add the --retries flag. Fourth, switch to a faster mirror.

Fifth, check your proxy and firewall. Sixth, upgrade pip. These steps solve most timeout errors.

Keep your commands simple and test one fix at a time. This helps you find the real cause faster.

Conclusion

The pip install timeout error is common but easy to fix. It happens when pip cannot reach the server in time.

Start with the --timeout flag. Add the --retries flag if needed. Switch to a faster mirror for better speed. Check your proxy and firewall if the problem continues.

Upgrading pip and using a config file make your setup more reliable. For very slow networks, download packages manually.

With these solutions, you can install any Python package without frustration. Try them today and get back to coding.