Closed GenevieveBuckley closed 5 years ago
It looks like there are two problems here:
I think this issue should be a relatively high priority, because without a fix users can't run the app if they're offline. For this reason I'm gonna call it a bug - we should be able to support offline use.
Problem 1 is fairly easy to fix - you can add the jar as a data file to datas in the spec file. Relevant stackoverflow.
Problem 2 is harder - see comment below.
Here's the traceback if you try to start Podo when offline:
2018-06-06 13:41:25,623 Podocyte automated analysis program
2018-06-06 13:41:25,624 06-Jun-2018_13-41PM
2018-06-06 13:41:25,625 Processing file: /Users/genevieb/Desktop/test_podo/little_input/51559.lif
[23833] Failed to execute script launch-gui
/var/folders/gz/6f0v_zhs09x38mb4td_h6py80000gn/T/_MEIG2l5tq/pims/bioformats.py:53: UserWarning: loci_tools.jar not found, downloading
/var/folders/gz/6f0v_zhs09x38mb4td_h6py80000gn/T/_MEIG2l5tq/pims/api.py:191: UserWarning: <class 'pims.bioformats.BioformatsReader'> errored: <urlopen error [Errno 8] nodename nor servname provided, or not known>
Traceback (most recent call last):
File "bin/launch-gui.py", line 3, in <module>
File "site-packages/gooey/python_bindings/gooey_decorator.py", line 89, in <lambda>
File "podocytes/main.py", line 98, in main
File "site-packages/pims/api.py", line 193, in open
pims.api.UnknownFormatError: All handlers returned exceptions:
<class 'pims.bioformats.BioformatsReader'> errored: <urlopen error [Errno 8] nodename nor servname provided, or not known>
06-Jun-2018_13-41PM
Pims bioformats.py looks in several locations to find loci_tools.jar before downloading a copy if it can't find it locally. Search locations are:
os.path.join(os.environ['PROGRAMDATA'], 'pims')
os.path.join(os.environ['LOCALAPPDATA'], 'pims')
os.path.join(os.environ['APPDATA'], 'pims')
os.path.join(os.path.expanduser('~'), '.config', 'pims')
If pims does not find loci_tools.jar in any of these places, it'll download it from:
url = ('http://downloads.openmicroscopy.org/bio-formats/' + version + '/artifacts/loci_tools.jar')
where version='5.7.0'
Additionally, it may be worth bundling a newer version of loci_tools.jar (pims default is to download v 5.7.0 but more recently available is v5.8.2 see here for the latest).
Advice from pims developers:
https://github.com/soft-matter/pims/issues/299#issuecomment-401460062
If you like to bundle pims and bioformats in a single package, you can do so by putting loci_tools.jar right next to bioformats.py. That is the first place the program looks. So you do not need to modify any functions. Including binary files inside a python distriubtion can be done using a MANIFEST.in file, like so: https://github.com/soft-matter/pims/blob/master/MANIFEST.in Thanks for the heads up about the version, I could find a stable solution to get the latest version number automatically so we are stuck with bumping it every now and then. You could call the pims.bioformats._download_jar(version=xxx) if you want to have a different version.
cc @jni
This download seems to happen every time the app is run. Perhaps there's a way we can bundle it into the app build so this doesn't occur.