ImportError: No module named certifi

Hi

I have install a Requests module in my python v 2.7.2 as you instructed but I tried to create a simple script using Requests module i got the above error.

The script look like this with error

> > > import requests
> > > 
> > > r = requests.get('https://facebook.com',auth=('email', 'password'))

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\requests\api.py", line 51, in get
    return request('get', url, *_kwargs)
  File "C:\Python27\lib\site-packages\requests\api.py", line 39, in request
    return s.request(method=method, url=url, *_kwargs)
  File "C:\Python27\lib\site-packages\requests\sessions.py", line 203, in reques
t
    r.send(prefetch=prefetch)
  File "C:\Python27\lib\site-packages\requests\models.py", line 502, in send
    cert_loc = **import**('certifi').where()
ImportError: No module named certifi


Did you install using easy_install or pip? It looks like you don't have the dependencies installed.


I just download zipball from GitHub website, then I unzipped and install it by run a setup.py install in DOS command.

I am new in python I don't understand what is dependencies, and I choose the above option of installing because it look easy but the one from pip i didn't understand..

For example the said:  Download get-pip.py and execute it, using the Python interpreter of your choice.... I don't get it
then this command are you running on DOS or on which interface
"$ curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python"


The above command in a shell command being executed in a Linux environment.

Follow these instructions to install pip on Windows: http://docs.python-guide.org/en/latest/starting/install/win/#distribute-pip

To summarize:
1. Download and run http://python-distribute.org/distribute_setup.py (`python distribute_setup.py`).
2. Install pip with the command `easy_install pip`.

Dependencies are other pieces of software/libraries that something requires in order to function. If you install python modules using pip, the required dependencies will be downloaded and installed automatically.


I still received an error from DOS command said " 'easy_install' is not recognized as an internal or external command,
operable program or batch file."

I managed to download distribute_setup.py, then I copy that file in the desktop. After that I went to DOS command i type this way
C:\Users\linda\Desktop\python>easy_install pip
'easy_install' is not recognized as an internal or external command,
operable program or batch file.

The I tried another I got the same error

C:>easy_install pip
'easy_install' is not recognized as an internal or external command,
operable program or batch file.


> I managed to download distribute_setup.py, then I copy that file in the desktop.

Have you run the script? (`python distribute_setup.py`).

Also, make sure `easy_install.exe` is on your `PATH`: http://packages.python.org/distribute/easy_install.html#windows-notes


Sorry before I try anything I don't have that file  easy_install.exe. I just download only python distribute_setup.py file, where can I get that file.


That's what running `distribute_setup.py` does, it installs it for you. The executable should then be in `C:\\Python2X\\Scripts` which should be in your PATH.


I managed to do as you said i got this results

C:\Python27\Scripts>easy_install pip
Searching for pip
Best match: pip 1.1
Processing pip-1.1-py2.7.egg
pip 1.1 is already the active version in easy-install.pth
Installing pip-script.py script to C:\Python27\Scripts
Installing pip.exe script to C:\Python27\Scripts
Installing pip-2.7-script.py script to C:\Python27\Scripts
Installing pip-2.7.exe script to C:\Python27\Scripts

Using c:\python27\lib\site-packages\pip-1.1-py2.7.egg
Processing dependencies for pip
Finished processing dependencies for pip

But when I went back to run that code in python shell I got the same error which said
"ImportError: No module named certifi"

So I don't know what is problem now


Now that you have installed pip, you need to use it to install requests. `pip install requests`.


I have already install requests before that why when I run your command I got the following results

C:\Python27\Scripts>pip install requests
Requirement already satisfied (use --upgrade to upgrade): requests in c:\python2
7\lib\site-packages
Cleaning up...


@morogoro plese do what it says(use --upgrade) since you may have requests module in the right place without the dependencies which may confuse pip.


BKY can help me with the command that I should type in DOS for upgrade 


@morogoro It should be
C:\Python27\Scripts>pip install --upgrade requests


I got this 
C:\Python27\Scripts>pip install --upgrade requests
Requirement already up-to-date: requests in c:\python27\lib\site-packages
Cleaning up...


@morogoro Then can you please try to _delete_ everything seems like "requests" in your site-packages folder and try again?


its working now thanks a lot @BYK @johtso 


Hey @morogoro, I seem to be having the exact same problem you were having. I've tried deleting everything and re-installing but have had no luck. 
May I ask what exactly you did to get it working? 
Thanks. 


@rbui have you tried doing `pip uninstall requests` maybe?


@johtso That was exactly what I was looking for, thanks for the quick reply!


+1 to having this problem.

I did a clean virtualenv and ran `pip install requests`. I can see it downloading and installing certifi but it seems like their setup is broken since I still get the error ImportError: No module named certifi 

**EDIT**: Totally removing both requests and certifi and then re-installing worked.


Hey @rbui sorry for not reply quickly, I was not around..........