Search code examples
pythonmodulepippython-3.6site-packages

Not able to import a module that is already installed


I am trying to import a module "requests" but it shows the following error

File "manager.py", line 12,

import requests

ModuleNotFoundError: No module named 'requests'

Then I also verified the pip list using

python -m pip list

and it includes the requests module. also when I try to import it in the python interpreter it successfully imports the module.

>>> import requests

when I try

pip install requests 

its says Requirement already satisfied: requests in /usr/lib/python3.6/site-packages

How can I resolve his issue ???

Thanks in advance


Solution

  • Make sure that your sys.path variables are correct. I've messed up before where the "site-packages" path got removed and caused imports to get wonky.