0

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

1 Answers1

0

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.

LamerLink
  • 111
  • 6
  • Thanks, actually am running on remote server. Can you tell me how can i update the sys.path file. Other imports are working just requests is not working. – Owais Qayum Mar 24 '20 at 20:01
  • You can use the `sys.path.append()` or `sys.path.insert()` functions, however, if other non-built-in packages are importing than this is likely not the issue. – LamerLink Mar 25 '20 at 21:14
  • I also should have said that you can use `sys.path.remove()` if there is an errant entry that you want to change with `insert`. – LamerLink Mar 25 '20 at 21:16