Error: ModuleNotFound. I've tried everything

I’m trying to get PySimpleGui up and running in VS Code. I installed it using Pip. If I list the installed pip modules with python -m pip list, PySimpleGui version 4.60.3 is right there in the list. I found the file location and added it to the extensions path in settings. I upgraded Pip to the latest version and tried again. This is everything I can find on Stack Overflow to do with this issue - I’m still getting “ModuleNotFound error” with the PySimpleGui module when I try and run my code.

Has anyone found a solution to this?

Did you run the code and try refreshing VS Code? Or is it just showing red lines below. Try running the Developer: Reload Window command. This has happened to me many times. It usually works when I do one of these.

Thanks for the suggestion - I tried running Developer: Reload Window but it is still giving me the error. It’s baffling.

Try creating a virtual environment and reinstall package using pip and use it

Steps to create virtual environment in vscode terminal for python 3 in windows

py -3 -m venv .myproject

now the venv created in the name myproject

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process

this command sets the policy to activate the venv for one time if not used activation error will occur


this command activates the venv in windows


type this to finally close the venv

did you first install the module with pip install moduleName?

Not a bad idea, but I think I’ve found the problem. I tried a different library and it didn’t work either with the same error, so I went to check the Python Interpreter and VS Code seems to have reverted it back to the default windows interpreter at some point, which I don’t usually use. I changed the interpreter and (fingers crossed) looks like it’s working now.

Yes. Why would it be listed under python -m pip list, as I mentioned, if I hadn’t?
Never mind because I think I’ve found the problem

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.