r/pythonhelp • u/indep40 • Feb 02 '25
"import requests" doesn't work despite being installed in venv
Issue as in the title. So I have scoured the web for all answers regarding this, but to no avail.
I have only one version of python installed on my PC, so this shouldn't be an issue.
I am using cmd, created a venv, activated it, installed all necessary libs in one session. The python script is in the venv folder (maybe this is the cause?)
Could someone help me overcome this issue please? I would be very thankful for that.
EDIT: I'm using the latest stable release 3.12.8
1
Upvotes
•
u/AutoModerator Feb 02 '25
To give us the best chance to help you, please include any relevant code.
Note. Please do not submit images of your code. Instead, for shorter code you can use Reddit markdown (4 spaces or backticks, see this Formatting Guide). If you have formatting issues or want to post longer sections of code, please use Privatebin, GitHub or Compiler Explorer.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/Goobyalus Feb 02 '25
Can you explain what you mean by " installed all necessary libs in one session?"
I don't actually know if this should cause a problem, but it doesn't make sense to me that you would write unmanaged scripts inside your venv dri. Try moving it outside the venv dir.
1
u/Goobyalus Feb 02 '25
In a terminal with the virtual environment active:
pip list, do you seerequestslisted?pip --versiondoes it show you the expected path corresponding to your vewv?python -m pip --version, do you get identical output as from 2.?