I looked this question here:
Is it possible to require PyQt from setuptools setup.py?
What's the proper way of distributing a python application that has a gui and it's based on PyQt ? (I am using PyQt5 and Python3)
I am still learning how to distribute things, so I don't know if my question makes sense.
sudo pip3 install .
In a word yes, as long as you restrict your support to PyQt5 and Python3.
The requirements specified in
setup.py are typically provided by requesting packages from the Python Package Index (PyPi). Until recently these packages were source only, meaning that an installation depending on PyQt5 would only work on a system where it was possible to build it from source. Building on Windows in particular requires quite a lot of set up, and this would therefore put your application out of reach for anyone unable or unwilling to do this.
Note: As far as I am aware, it was never actually possible to build from source via PyPi. The standard approach was to download the source/binaries from Riverbank Software and build/install from there.
This problem was solved by the introduction of Python Wheels which provide a means to install C extension packages without the need for compilation on the target system. This is achieved by platform-specific
.whl files. Wheels for PyQt5 on Python3 are available on PyPi for multiple platforms, including MacOS X, Linux (any), Win32 and Win64 which should cover most uses.
For example, this is the output when pip-installing PyQt5 on Python3 on a Mac:
mfitzp@MacBook-Air ~ $ pip3 install pyqt5 Collecting pyqt5 Downloading PyQt5-5.6-cp35-cp35m-macosx_10_6_intel.whl (73.2MB) 100% |████████████████████████████████| 73.2MB 2.5kB/s Collecting sip (from pyqt5) Downloading sip-4.18-cp35-cp35m-macosx_10_6_intel.whl (46kB) 100% |████████████████████████████████| 49kB 1.8MB/s Installing collected packages: sip, pyqt5 Successfully installed pyqt5-5.6 sip-4.18
To set PyQt5 as a dependency of your own package simply specify it as normal in your
Here you have a few options. The above means that anyone with Python3 installed can now install your application using
pip. However, this assumes that the end-user has Python and knows what
pip is. If you are looking to distribute your application with a Windows installer, MacOSX 'app' bundle, or Linux package, you will need to use one of the tools dedicated to that purpose.
.whlfiles which will solve this in many cases. By far the easiest if you're targeting Windows-only.
.appbundles from the definition in your
setup.py. Big advantage is the custom handlers that allow you to adjust packaging of troublesome packages. If you're only targetting MacOSX this is probably your best option.
Note: It is possible to write a very complex
setup.py that allows you to build using one or more tools on different platforms, but I have usually ended up storing separate configs (e.g.
setup-py2app.py) for clarity.