Closed michaelgoetze closed 3 years ago
Did you install glypy
with pip install glypy
or by running python setup.py install
from the source directory?
A long standing issue with PyInstaller, https://github.com/pyinstaller/pyinstaller/issues/2717, prevents it from automatically collecting data files from packages installed with pip
.
When I use glypy
with PyInstaller, I install glypy
from source using python setup.py install
. If that's not an option for you, you can probably write an import hook to add the package data to the datas
tracker from PyInstaller.
# filename: hook-glypy.py
from PyInstaller.utils.hooks import collect_data_files, collect_submodules
datas = collect_data_files('glypy')
Place this script in a directory called hooks
in the working directory and run pyinstaller min_test.py -F --additional-hooks-dir ./hooks
.
Please let me know if this resolves the issue.
Hi,
installing from source solved the issue. If I run into this again I might also try the hook option.
thanks for the quick reply!
I tried to produce a windows executable using glypy and pyinstaller. The program fails to start after producing an executable as soon as I import glycoct.This is the error that I get:
My minimum test file looked like this:
I haven't tested whether it also fails with other imports. I am running windows 10 and python 3.8.5. I tested this in a venv, where it is running fine. The following packages were installed in the venv:
To create a single executable file, I ran pyinstaller with the following command and started the executable in the dist-folder.
I see that the issue is the missing file 'monosaccharides.hjson' (which I also can't find on disk). Is there a way to use pyinstaller with glypy? When I omit the glycoct import, the program works. I couldn't deduce where the program gets the path for the temporary folder and whether I could relpace this and provide the hjson-file(s) another way (e.g. in a bin folder next to the executable)
Without the -F flag glypy was not looking for the hjson-file(s) in a temp folder somewhere in Appdata but in the current working directory. So copying the master branch of the repository made the program work.
So my main question is, is there a way to make glypy and pyinstaller work with the -F flag?