You might actually be missing certifi
module.
Overview:
From your error stack trace, it appears that you are using Windows platform and have the native windows Python installation. So I will stick to Windows instructions here. But since I have Cygwin based python installation, I will provide here cygwin-based steps to resolve your issue.
However, you can very easily use these steps on the Windows command prompt as well, by installing pip
or easy_install
, pre-built binary, or source code.
Windows-Cygwin-Pip way:
- Add the directory that hosts python executable to your environment's PATH variable. Instructions here
- Get pip to easily install new python packages. Best way is to download get-pip.py in cygwin’s home directory and run
python get-pip.py
in cygwin bash shell command prompt. Detailed and Alternative instructions here
- Run
pip install requests
in the cygwin bash shell. It will install requests
and certifi
packages, which results in results
, requests-2.4.0.dist-info
, certifi
, and certifi-14.05.14-py2.7.egg-info
in the /lib/site-packages folder.
- Run python and execute your original line of code
import requests
. It will run without errors.
Alternatives Ways to Installing a New Package:
There are several other alternatives of downloading this requests
package, or for that matter any new python package. These include:
- Getting
easy_install
in Cygwin and Running easy_install requests
. Get easy_install
in cygwin by installing setuptools
package or by following instructions here.
- Downloading a pre-built binary available here. And running it as executable. It will automatically install the module under the latest python installation available in windows registry.
- Downloading source code for
requests
from Github into the home directory and Running python setup.py install
Python-Requests Installation Doc:
There is a brief list of ways to install requests
available on the original python-requests project website as well. See here.