Hi!
I've build a simple GUI using Tkinter which I would like to freeze to a standalone executable. I am doing this inside a conda environment. Working with OSX 10.15.7, python 3.7, PyInstaller 4.5.1 and conda 4.10.0.
If I create a conda env, import needed modules, set PYTHONPATH and run the script like the following, it works perfectly.
conda create --name imsepcondaenv python=3.7 -y
conda activate imsepcondaenv
pip install tensorflow==1.14 pillow==8.4.0 humanfriendly==10.0 matplotlib==3.4.3 tqdm==4.62.3 jsonpickle==2.0.0 statistics==1.0.3.5 requests==2.26.0
conda install -c conda-forge pyinstaller -y
cd ~/Applications/ImSep_files
export PYTHONPATH="$PYTHONPATH:$PWD/ai4eutils:$PWD/cameratraps"
python ImSep/ImSep_GUI.py
However, if I use PyInstaller to make an executable it creates an exe which opens the program fine but throws an error when the users starts a process.
I have added the paths to the folders with the --paths flag, but the error remains:
conda create --name imsepcondaenv python=3.7 -y
conda activate imsepcondaenv
pip install tensorflow==1.14 pillow==8.4.0 humanfriendly==10.0 matplotlib==3.4.3 tqdm==4.62.3 jsonpickle==2.0.0 statistics==1.0.3.5 requests==2.26.0
conda install -c conda-forge pyinstaller -y
cd ~/Applications/ImSep_files
export PYTHONPATH="$PYTHONPATH:$PWD/ai4eutils:$PWD/cameratraps"
cd ImSep
pyinstaller --onefile --name='ImSep' --icon='imgs/logo_small_bg.icns' --paths=/Users/peter/Applications/ImSep_files --paths=/Users/peter/Applications/ImSep_files/ai4eutils --paths=/Users/peter/Applications/ImSep_files/cameratraps --paths=/Users/peter/Applications/ImSep_files/cameratraps/detection --debug=imports --hidden-import=detection.run_tf_detector --clean ImSep_GUI.py
The folder structure looks like this (simplified):

I have messed around with the tips on the When Things Go Wrong page (hooks, paths, hidden imports, debugs, latest version etc), but I didn't succeed.
Does anybody have an idea of what I'm doing wrong?
FYI, if you are on OSX/UNIX you can reproduce the error with the following commands. It is a GUI for a model trained by Microsoft to distinguish between images with and without animals.
mkdir ImSep_files
cd ImSep_files