[Solved] Python module not found even though “Requirement Already satisfied in Pip”

writing some python in OS X, and it’s saying several packages I installed with pip “ImportError: no module named requests”

When running pip install requests

> sudo -H pip install requests 
Requirement already satisfied: requests in /usr/local/lib/python2.7/site-packages 
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python2.7/site-packages (from requests) 
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python2.7/site-packages (from requests) 
Requirement already satisfied: urllib3<1.22,>=1.21.1 in /usr/local/lib/python2.7/site-packages (from requests) 
Requirement already satisfied: idna<2.6,>=2.5 in /usr/local/lib/python2.7/site-packages (from requests)

it’s erroring on twindb_cloudflare, requests, group, tarutil, and MySQL DB. I’m able to run the exact same imports on another script (in the same folder) without error.

Solution #1:

Run in command prompt.

pip list

Check what version you have installed on your system if you have an old version.

Try to uninstall the package…

pip uninstall requests

Try after to install it:

pip install requests

You can also test if pip does not do the job.

easy_install requests
Respondent: Abhishek Parikh

Solution #2:

i had the same issue(also in MAC OS) and solved it by instead running the python script with python3:

in my case i was also using pip3 and not pip.

Respondent: Daniel Badyan

Solution #3:

I suffered from this problem and finally found the solution.

Defaulting to user installation because normal site-packages is not writeable

Requirement already satisfied: django in /usr/lib/python3/dist-packages (2.2.12)

‘sudo’ to crossoff user installation issue;

and pip install –target=/usr/local/python3.7/site-packages –upgrade {module_name}

someone mentioned this and worked for me.

Respondent: cUteDeVil

Solution #4:

If you are using a Mac, it could be that you installed the modules with pip (meaning python2, but you execute your code with python3 which does not have the modules you installed for python2).

Mac has python version 2 set as default and usually does not come with pip preinstalled or is linked with version 2. I recommend leaving it that way. Use version 3 for your personal use cases and leave your Mac with version 2 as default. As you have to install python3 yourself, means you might also want to check/install pip3.

Check if you have python 3 installed:

python3 --version

Check if you have pip3 installed (usually included by default since python 3.4):

pip3 --version

Check what packages you have installed with pip3:

pip3 list

If you use an editor tool, make sure to set it to use python3 when running your file.

Example for VS Code:
Set VS Code to use Python3 on the bottom right corner, which you should see when having a .py file open: Set Python version

And now if you want to import any modules into python, make sure to install them with pip3:

pip3 install package_name

If you run into permission issue, you might consider to run the command with sudo rights:

sudo pip3 install package_name
Respondent: Flavio Caduff

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Most Popular

To Top
India and Pakistan’s steroid-soaked rhetoric over Kashmir will come back to haunt them both clenbuterol australia bossier man pleads guilty for leadership role in anabolic steriod distribution conspiracy