Newbie has question about pysimplegui

So, I watched this video and just copied and pasted the code there. Why I get Traceback? I’m using pycharm I downloaded from Jetbrains.

What does the traceback say? There’s no way to know what the problem is if you don’t give any details. Please copy and paste the full traceback, and to ensure that it’s displayed formatted, select the traceback text when you paste it and then click the </> button.

C:\Users\Han\anaconda3\python.exe C:\Users\Han\PycharmProjects\SAMPLE_CODES\pysimplegui.py
Traceback (most recent call last):
File “C:\Users\Han\PycharmProjects\SAMPLE_CODES\pysimplegui.py”, line 1, in
import PySimpleGUI as sg
ModuleNotFoundError: No module named ‘PySimpleGUI’

Process finished with exit code 1

Thanks :slight_smile:

It’s telling you that PySimpleGUI isnt installed.

You need to pip install PySimpleGUI

Hope that helps!

On Windows, the recommended way to install packages is via the Python Launcher and the pip module.

Open a Command Prompt window and type:

py -m pip install PySimpleGUI

1 Like

Totally, follow this advice rather than mine!

OK. I did that and command prompt says it’s been installed. But pycharm still gives the same message :frowning:

That may be because you’re using a different python install. “pip”
installs for the Python which was used to unvoke it. (And that is why
the recommended way to use pip is as somepython -m pip ... so that
it installs for whatever somepython you’re using.)

I notice that your original post shows C:\Users\Han\anaconda3\python.exe as the Python executable.
Is that recited by PyCharm when you run your script?

If so, it is very possible that the py command is not running that
Python. Try this:

 C:\Users\Han\anaconda3\python.exe -m pip install PySimpleGUI

and see what effect it has.

Cheers,
Cameron Simpson cs@cskk.id.au

I’ve never been to Australia. I have met a lot of Koreans from there though. Anyway, I tried that, and this is the message I get :frowning:

C:\Users\Han\anaconda3\python.exe C:\Users\Han\PycharmProjects\SAMPLE_CODES\pysimplegui.py
Traceback (most recent call last):
File “C:\Users\Han\PycharmProjects\SAMPLE_CODES\pysimplegui.py”, line 1, in
import PySimpleGUI as sg
ModuleNotFoundError: No module named ‘PySimpleGUI’

Process finished with exit code 1

So, you’re using Anaconda?

I believe that has its own package manager called conda, so you could try:

conda install PySimpleGUI

Actually, it’s Pycharm community 2023.1.

Have you read this:

# Install, uninstall, and upgrade packages