Installing PySimpleGUI
PySimpleGUI releases are distributed through the PyPI package repository. Development builds are versions of PySimpleGUI that have not yet been released to PyPI. These updates are installed through PySimpleGUI itself.
Invoking Python
It's important that you run the correct version of Python.
For Windows you'll use the command python
to invoke Python 3. On Linux and the Mac, the command to invoke Python 3 is python3
. If you type python
on some versions of the Mac, it will execute Python 2, not Python 3.
To be safe and save yourself perhaps hours of frustration, try typing the command to invoke Python to ensure you know which is the correct one for your system.
IMPORTANT - If you see python
in the instructions, understand that the command you may enter is python3
depending on the outcome of your quick test.
Virtual Environments and IDEs
If you are running a virtual environment or you are pip installing from within an IDE such as PyCharm, then the specific instructions will differ, but the overall process is the same. You are pip installing from PyPI to get PySimpleGUI. How you accomplish this is dependent upon your environment.
These instructions assume a basic Python environment to keep them as simple to follow as possible.
Basic First-time Install
PySimpleGUI is installed using Python's pip
command. If you're using the standard tkinter port (the default port) then you can install PySimpleGUI by typing:
python -m pip install PySimpleGUI
Instructions for installing the other ports is provided on the port's specific page in the Ports section.
These ports require the use of 3rd party packages and thus have some additional steps and licensing considerations for you to keep in mind.
Linux Installs
Because PySimpleGUI creates several executables that are invoked from the command line, these need to be on your path. The psgmain
& psghome
are examples of the PySimpleGUI built-in command line utilities that are installed. This often means you'll need to use sudo
so that the install happens at the system rather than user level
sudo python3 -m pip install PySimpleGUI
Troubleshooting Basic Install Problems (on Linux)
On some versions of Linux you will need to first install pip.
sudo apt install python3-pip
tkinter
is a requirement for PySimpleGUI. Some OS variants, such as Ubuntu, do not come with tkinter
already installed. If you get an error similar to:
ImportError: No module named tkinter
then you need to install tkinter
.
You can do this with the command:
sudo apt-get install python3-tk
Reinstalling
If you're having problems upgrading, then you should try to uninstall the old version and install the newer version you're trying to upgrade to.
To uninstall PySimpleGUI::
python -m pip uninstall PySimpleGUI
Then you can re-install from scratch:
python -m pip install PySimpleGUI
Other Required Packages
PySimpleGUI 5 requires the RSA package. When you pip install PySimpleGUI 5, it will automatically install RSA for you.
For the non-tkinter ports of PySimpleGUI, such as PySimpleGUIQt, these versions of PySimpleGUI will install the required GUI framework package for you. For example, PySimpleGUIQt requires PySide2 or PySide6. If none of these have been installed on your system, then when you install PySimpleGUIQt it will install either PySide2 or PySide6. The version of Python you are running determines which of these will be installed.