ModuleNotFoundError: No module named 'requests' even after pip installed requests in Pycharm

Viewed 719

Previously "requests" library was working, but I wanted to do a project and install a few libraries and "requests==2.22.0" was included among the libraries. After installing the libraries, I found out I get an error on PyCharm:

Traceback (most recent call last):
  File "C:/Users/User/Desktop/python/projects/youtube downloader.py", line 5, in <module>
    import requests
ModuleNotFoundError: No module named 'requests'

When I tried to install requests again using pip, I keep getting these errors, I also tried to uninstall requests and then re-install:

C:\Users\User>pip3 install requests
Requirement already satisfied: requests in c:\users\muffin\anaconda3\lib\site-packages (2.21.0)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\users\User\appdata\roaming\python\python37\site-packages (from requests) (3.0.4)
Requirement already satisfied: idna<2.9,>=2.5 in c:\users\User\appdata\roaming\python\python37\site-packages (from requests) (2.8)
Requirement already satisfied: urllib3<1.25,>=1.21.1 in c:\users\User\appdata\roaming\python\python37\site-packages (from requests) (1.24.1)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\User\appdata\roaming\python\python37\site-packages (from requests) (2018.11.29)

C:\Users\User>pip install requests
Requirement already satisfied: requests in c:\users\muffin\anaconda3\lib\site-packages (2.21.0)
Requirement already satisfied: idna<2.9,>=2.5 in c:\users\User\appdata\roaming\python\python37\site-packages (from requests) (2.8)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\users\User\appdata\roaming\python\python37\site-packages (from requests) (3.0.4)
Requirement already satisfied: urllib3<1.25,>=1.21.1 in c:\users\User\appdata\roaming\python\python37\site-packages (from requests) (1.24.1)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\User\appdata\roaming\python\python37\site-packages (from requests) (2018.11.29)

I noticed I have two? pythons in my computer, but I never got to know what I should do with two pythons (I use Ananconda for Jupiter notebook and PyCharm), and I'm assuming this can be the issue of why pip is not working as I expected... Or not. I am very confused.

++ So I found out in Jupiter notebook, I can import requests library without any issues, so I think I need to download the library in the other path???..

Can anyone help? Thank you so much in advance.

1 Answers

You have not configured Python interpreter for PyCharm. Follow this tutorial and you should be fine. I'd recommend to use Anaconda and create a virtual environment, either manually or inside PyCharm. Install requests to that environment.

Related