#🔒 ModuleNotFoundError :(
75 messages · Page 1 of 1 (latest)
@spiral bone
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
!code
I did it
Several times.
But i don't know why it's still errors in there
I've even downloaded the requirements.
do py -0p in your terminal
Right, I don't want to see that. I want to see the terminal is VSCode after you press the run button
import requests
ModuleNotFoundError: No module named 'requests'
(.env) sh-5.2$ "/home/bazzite/چت بات/.env/bin/python" "/home/bazzite/چت بات/.env/a/goldeneye.py"
Traceback (most recent call last):
File "/home/bazzite/چت بات/.env/a/goldeneye.py", line 16, in <module>
import requests
ModuleNotFoundError: No module named 'requests'
(.env) sh-5.2$
Can you do pip --version in that same terminal?
(.env) sh-5.2$ pip --version
Traceback (most recent call last):
File "/var/home/bazzite/چت بات/.env/bin/pip", line 7, in <module>
from pip._internal.cli.main import main
ModuleNotFoundError: No module named 'pip'
(.env) sh-5.2$
...... okay I am now a bit concerned about where this venv was created from. Can you run this last command for me:
python -m pip --version
Traceback (most recent call last):
File "/var/home/bazzite/چت بات/.env/bin/pip", line 7, in <module>
from pip._internal.cli.main import main
ModuleNotFoundError: No module named 'pip'
(.env) sh-5.2$ python -m pip --version
/var/home/bazzite/چت بات/.env/bin/python: No module named pip
(.env) sh-5.2$
So when you pasted the results of pip list before, that was in a different terminal outside of VSCode?
Yes
Linux terminal
In the VSCode terminal, can you run this: .env/bin/activate and then do pip --version?
in that other terminal, can you do pip --version?
(.env) sh-5.2$ .env/bin/activate
sh: .env/bin/activate: Permission denied
(.env) sh-5.2$
Traceback (most recent call last):
File "/var/home/bazzite/چت بات/.env/bin/pip", line 7, in <module>
from pip._internal.cli.main import main
ModuleNotFoundError: No module named 'pip'
(.env) sh-5.2$ python -m pip --version
/var/home/bazzite/چت بات/.env/bin/python: No module named pip
(.env) sh-5.2$
How did you do pip list if pip --version is now erroring in that same terminal?
Sorry I put it in wrong terminal
(.env) bazzite@bazzite:~$ pip --version
pip 25.2 from /var/home/bazzite/چت بات/.env/lib64/python3.13/site-packages/pip (python 3.13)
(.env) bazzite@bazzite:~$
Here is the Linux terminal
I think there is something wrong with path
Or vs code
Can you fully restart VSCode, open a terminal within VSCode, do .env/bin/activate, and then do pip --version?
Also, I think I know the answer to this question, but to create the venv did you install Python separately or is the venv based off of what shipped with your OS?
Restart? You mean close it and then open VS code?
Yeah, fully close all processes of it and then re-open it
I downloaded it through my vs code, but I did pip through the Linux terminal.
So Python is not something you can download through VSCode, you likely just installed the VSCode extension to work with Python from VSCode. If you didn't install separately, then it is based on your OSes default Python. That Python usually doesn't have pip installed.
The weird part here is VSCode is not picking up your env's site-packages folder which does have pip....
I think I'm cooked right?
Can you take a screenshot of the bottom right hand corner of VSCode? I want to see what interpreter it's using
How should I fix it?
screenshot first and then we can figure out to go about it
Bottem right
Ya I think
Can you click that and take a screenshot of what pops up near the top of the screen?
The issue is that this says 3.13. These are 2 different Python versions
This thing pops up
When you click the ".env (3.12.11)" thing?
Ya
Are you sure you're clicking on the right thing? Because that isn't what should be popping up
You should see something like this instead
Okay, can you go to settings and open up the command palette instead?
Ya
I open it
Type: "Select Python Interpreter" and you should see something pop up similar to that
Ya
Now I see the python version list
Cool, can you share what pops up?
Have you ever created multiple venvs in the same folder?
I am not concerned somehow have a clashing 3.12 and 3.13 living in the same venv
Okay, so that's the issue.
Both in a folder Named چت بات
Venvs should be project specific. Each project should get its own folder and 2 venvs with the same name should not be created in the same spot.
Oh..
So I have to delete the folder then create a new one?
I would do this:
- Create a new folder for your project
- Create a venv in that folder and move your code over
- Activate the venv in that folder and install the modules you need there
If you want more projects int he future, they get their own separate folders with their own separate venvs
I have to install python in new folder?
Thanks, buddy, you saved me from a several hour long nightmare ❤️🩹
Not necessarily, just create a new venv and that should hopefully be fine
Ok tnx
Have a great night, bye
This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.