-
Clone the git repository
$ git clone https://github.com/zwei-beiner/HiggsMechanism.git
This creates a new directory./HiggsMechanism
. -
Navigate into the new directory
$ cd ./HiggsMechanism
-
Create a new python virtual environment
$ python3 -m venv venv
-
Activate the virtual environment
$ source venv/bin/activate
-
Update pip
(venv)$ pip install --upgrade pip setuptools
-
Install the required dependencies
(venv)$ pip install PyQt5 numpy pyqtgraph pyinstaller
-
Run the build command
(venv)$ pyinstaller --name "Higgs Simulator" --icon icon.ico --windowed main.py
This creates the directoriesbuild
anddist
and the fileHiggs Simulator.spec
.
The .app executable can be found indist
. Additionally, a command-line executable can be found atdist/main/main
.
Standard practice on using pyinstaller documentation and StackOverflow applies.
To get more debug information when building, use the --debug=all
flag:
(venv)$ pyinstaller --debug=all main.py
(Note: If pyinstaller
gives a WARNING
about missing imports, they can possibly be ignored, e.g. warnings about pkg_resources.py2_warn
and pkg_resources.markers
can be ignored at the time of writing. To test which missing imports can be ignored, write a small demo program which is guaranteed to work and run pyinstaller on it, then look at which missing imports pyinstaller is complaining about.)
.ico file was created by uploading a square high-resolution png to https://icoconvert.com and selecting "Custom sizes", "Multi-size in one icon" and selecting all 9 sizes, then click "Convert ICO" (We have to do this because an .ico file stores all possible resolutions we might want to display, up to 256x256.)
Microsoft releases free Windows virtual machines for development (with the catch that the Windows license has an expiry date).
These can be downloaded here:
https://developer.microsoft.com/en-us/windows/downloads/virtual-machines/
VirtualBox was used and the resulting virtual machine was 50GB (!) in size.
In Windows, to build the ".exe" file,
-
Install git and python.
This can be done by downloading the installers from the websites. -
Follow the instructions above (for "On a Mac") with the changes:
- Run all commands in the command line as an administrator. To do this,
- Click on "Start"
- Type "cmd"
- Right-click the icon that shows up and click "As an administrator"
- "python3" becomes just "python"
- Activating the venv is done with the command
.\venv\Scripts\activate
- The build command is
pyinstaller --name "Higgs Simulator" --icon icon.ico --windowed --onefile main.py
- Run all commands in the command line as an administrator. To do this,