#๐ ModuleNotFoundError: No module named 'pygame'
31 messages ยท Page 1 of 1 (latest)
@ancient flame
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.
How are you running your file to get this error? Via "Run" in vsc/PyCharm or manually?
Do you have a venv or .venv folder in your project directory?
IDLE
Okay.
How are you pip installing - what command did you use?
pip install
When you use just pip, it may be that it's pip from other python version than the one you're running your file with
Please do pip --version
pip 25.0.1 from C:\Users\Alejandro\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pip (python 3.12)
Hmmm...
In the idle please run
import sys
print(sys.executable)
C:\Users\Alejandro\AppData\Local\Programs\Python\Python312\pythonw.exe
Huh. Looks like you have two 3.12 pythons next to each other.
Weird.
Since it's windows, please also do py -0p - let's see all versions it can recognise
^that command in cmd/powershell, not idle, of course
-V:3.12 * C:\Users\Alejandro\AppData\Local\Programs\Python\Python312\python.exe
maybe the package path isnt on PATH
So this recognises the idle version only, ok, weird.
In windows program removal thing in control panel ("add or remove programs" if your windows is in English), could you please look for python?
See if both are shown or only one
Yeah, but which one...
Could you remove both and just install python again? That would be the easiest instead of guessing
ok, i will try
When reinstalling, use the installer downloaded from python.org, do not try to install from Microsoft Store
ok
i have installed python from python.org but the error remains the same
@
@tender steppe
Well, now you gotta pip install again ๐ because when you uninstalled, it got removed
But instead of just pip, use py -m pip - that will make sure it uses the pip that belongs to whatever python py points to (so the version you just installed)
Also, pygame-ce is recommended over just pygame. Imports stay the same, just pip command changes to py -m pip install pygame-ce
CE version is a fork of the original, but is updated more
It works perfectly, thank you so much
:warning: The owner of this post is no longer in the server.
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.