Reputation: 167
I have a python code in PyCharm in which i am using import requests but the terminal is showing me the following error:
(venv) ahmad@Ahmad:~/Desktop/Spiders$ python test.py Traceback (most recent call last): File "test.py", line 1, in import requests ModuleNotFoundError: No module named 'requests'
But I have installed pip and requests as well.
Upvotes: 4
Views: 41929
Reputation: 1
Follow below steps if you are using IntelliJ
Go to
Project structure -> Click SDKs -> Click Packages TAB ->
Click '+' Sign -> Available packages screen shows -> In search box type name of package -> Select it and click 'Install Package"
Upvotes: 0
Reputation: 1
I followed the ...
settings > [projectname] > python interpreter > add interpreter
...steps described in other answers here. I got the location of the 'requests' install I knew I'd successfully completed by going back to the terminal, and using
pip install requests
again, and taking note of the install filepath from the 'Requirement already satisfied' output. Used that in the 'Settings...' step above, and voila!
Upvotes: 0
Reputation: 3
I had to go to the CLi (command line) and run ">pip install requests" - this after trying unsuccessfully from the Pycharm 'Setting/Interpreter' gui menu.
Upvotes: 0
Reputation: 144
You can just found the icon of Search in right highest corner and search for 'import modules'. Then click on "Project: [YOUR_PROJECT]" choose 'Python Interpreter' and then click on 'plus' button. Thus you can install 'requests' module manually.
(Some sites say that you can call Search by pressing Alt + Enter, but it doesn`t work in my case)
Upvotes: 0
Reputation: 101
you can use this :
just go to file > sitting > project : name > project interpreter > add > search and install
Upvotes: 8
Reputation: 1092
I am guessing you have not set your interpreter or installed the necessary packages in the interpreter in PyCharm.
File -> Settings
There, on the side panel, you can open your Project: <project_name> and check Project Interpreter
This will show the interpreter and the installed packages which you can use.
If the interpreter is empty, you need to add it.
https://www.jetbrains.com/help/pycharm/configuring-python-interpreter.html
Hope this helps.
Upvotes: 3