Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PySimpleGUI not importing
#1
I am using a Mac with PyCharm as my IDE.

I have Python 3.10.2 installed.

If I do python -m pip list I get told that...

Package     Version
----------- -------
pip         22.0.4
PySimpleGUI 4.57.0
setuptools  58.1.0
tk          0.1.0
Yet, when I open PyCharm and run a simple interface...

import PySimpleGUI as sg

filename = sg.popup_get_file('Enter the file you wish to process')
sg.popup('You entered', filename)
I get an error...

Error:
/Users/garynewport/PycharmProjects/stelcorGUI/venv/bin/python /Users/garynewport/PycharmProjects/stelcorGUI/main.py Traceback (most recent call last): File "/Users/garynewport/PycharmProjects/stelcorGUI/main.py", line 1, in <module> import PySimpleGUI as sg ModuleNotFoundError: No module named 'PySimpleGUI' Process finished with exit code 1
If I try to check that PySimpleGUI is installed by running an upgrade using python3 -m pip install --upgrade --no-cache-dir PySimpleGUI

I get told that everything is successful: Requirement already satisfied: PySimpleGUI in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (4.57.0)

So, all is installed and working yet will not be recognised within PyCharm.
Is this a path issue? Or am I missing something else?
Reply
#2
garynewport Wrote:stelcorGUI/venv/bin/python
venv means that you run from a virtual environment.
Look at Configure a Python interpreter.
If you want to use Python 3.10.2 on OS,you most specify the path to the Python executable on your system.

Virtual environment work like new Python installation(isolated),so if use venv(virtual environment) all need to installed to it,
it will not find or use dependencies OS(as show in your pip list).
garynewport likes this post
Reply
#3
please install the packages in a virtual environment also.
garynewport likes this post
Reply
#4
Thank you; all solved.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020