The ProblemIf you're staring at a wall of red text while trying to install a Python package, you're likely behind a corporate firewall. This usually happens when your company uses SSL Inspection (Deep Packet Inspection) via tools like Zscaler or Fortinet. When you run pip install, pip attempts to reach PyPI over a secure HTTPS connection. Your corporate proxy intercepts this, decrypts the traffic for scanning, and re-signs it using its own internal certificate.
Standard Python installations don't know about your company's private certificate authority. Because pip cannot verify the identity of the proxy, it kills the connection to protect you from a potential man-in-the-middle attack.
The Error Message```
pip._vendor.urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='pypi.org', port=443): ... [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)
## Root CausePip is surprisingly picky about security. Unlike your web browser, pip does not check the Windows System Certificate Store by default. Instead, it relies on an internal bundle of trusted certificates provided by the `certifi` library. When the proxy swaps the real PyPI certificate for a corporate one, pip checks its list, finds no match, and triggers the `SSLCertVerificationError`.
## Solution 1: The Quick Workaround (Low Security)Use this method if you need to install a single package like `pandas` or `requests` immediately. By marking specific domains as "trusted," you tell pip to skip the SSL check for those hosts only. It is a targeted bypass that is safer than disabling SSL globally.
pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org <package_name>
Note: You will have to type these flags every time you install something new.
## Solution 2: The "Set and Forget" MethodMost developers prefer a permanent fix. You can modify your global pip configuration so it always trusts the necessary domains. This is the most efficient way to handle persistent proxy issues on a work machine.
- Open your Command Prompt or PowerShell.- Execute the following command:```
pip config set global.trusted-host "pypi.org files.pythonhosted.org pypi.python.org"
This command automatically creates a pip.ini file at %APPDATA%\pip\pip.ini. From now on, pip will ignore certificate validation for these three primary Python package sources.
Solution 3: The Security-First Approach (Recommended)The most professional way to fix this is to teach pip to trust your corporate certificate. This keeps your connection encrypted and verified.
Step A: Export the Corporate Certificate- Navigate to https://pypi.org in Chrome or Edge.- Click the Lock Icon next to the URL > Connection is secure > Certificate is valid.- Switch to the Details tab and select the Root CA (the very top item in the hierarchy).- Click Export and save it as a Base-64 encoded X.509 (.CER) file.- Rename the file to company-root.pem.### Step B: Point Pip to the CertificateYou can tell pip exactly where to find this file using an environment variable. This ensures that other Python tools, like the requests library, also benefit from the fix.
setx PIP_CERT "C:\Users\YourName\Documents\company-root.pem"
setx REQUESTS_CA_BUNDLE "C:\Users\YourName\Documents\company-root.pem"
Note: Restart your terminal after running setx for the changes to take effect.
Solution 4: Merging Certificates into CertifiSometimes your local certifi bundle is simply out of date. If you can jump on a guest Wi-Fi or use a mobile hotspot for 60 seconds, try updating the bundle directly:
python -m pip install --upgrade certifi
If you must stay on the corporate network, find where your certs live by running:
python -c "import certifi; print(certifi.where())"
Open that file in Notepad++, scroll to the bottom, and paste the text content of your corporate .pem certificate. This merges your companyβs trust with the global standard.
VerificationTo confirm everything is working, try a clean installation. We use the --no-cache-dir flag to force pip to talk to the server rather than using a file already on your hard drive.
pip install --no-cache-dir requests
If the 100KB download finishes without errors, your Python environment is officially proxy-aware.

