Skip to content

Commit

Permalink
add readme file describing what worked for Windows pmag_gui standalone
Browse files Browse the repository at this point in the history
the .spec file is modified and works for windows
set_scripts is the readme file that describes the workflow
  • Loading branch information
duserzym committed Feb 17, 2023
1 parent 7ccb40b commit c99135a
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 0 deletions.
53 changes: 53 additions & 0 deletions pmag_gui.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# -*- mode: python -*-

# this is an example.spec file

import os
import sys
from pmagpy import version
sys.setrecursionlimit(30000)
app_name = "pmag_gui_{}".format(version.version[7:])
current_dir = os.getcwd()

block_cipher = None

files = [('{}/pmagpy/data_model/*.json'.format(current_dir), './pmagpy/data_model/'),
('{}/dialogs/help_files/*.html'.format(current_dir), './dialogs/help_files')
]


a = Analysis(['programs/pmag_gui.py'],
pathex=[current_dir],
binaries=[],
datas=files,
hiddenimports=['scipy.odr', 'scipy.io', 'scipy.fftpack',
'scipy.cluster','scipy.optimize', 'scipy.interpolate',
'scipy._lib.messagestream', 'scipy.datasets', 'scipy.misc',
# timdeltas appears necessary for Windows with
# conda-installed pyinstaller
'pandas._libs.tslibs.timedeltas',
'pandas.concat', 'wget', 'pkg_resources.py2_warn'],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
#name='pmag_gui',
name=app_name,
debug=False,
strip=False,
upx=True,
console=False, icon='./programs/images/PmagPy.ico')
app = BUNDLE(exe,
#name='pmag_gui.app',
name=app_name + ".app",
icon='./programs/images/PmagPy.ico',
bundle_identifier=None)
25 changes: 25 additions & 0 deletions setup_scripts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## A workflow that worked on 2/16/2023 for Yiming Zhang for Windows 10

Made a new conda enviroment

```conda create -n pmag_gui_compile python=3.9.13```

Activated that conda environment:

```conda activate pmag_gui_compile```

```conda install future matplotlib numpy scipy pandas```

- Use pip to install wxPython
- `pip install --upgrade -f https://wxpython.org/Phoenix/snapshot-builds/ wxPython`

- Use pip to install Pyinstaller
- `pip install git+https://github.com/pyinstaller/pyinstaller.git`

Compiled the program:

```pyinstaller pmag_gui.spec```



I used essentially the same pmag_gui.spec in the ```PmagPy``` repository to generate the executable file. Minor changes were necessary in the ```hiddenimports``` section where I had to add a few scipy modules in order for the excutable to initialize without crashing. That version of .spec file is saved here.

0 comments on commit c99135a

Please sign in to comment.