monashmicroimaging / podocytes

GNU General Public License v3.0
2 stars 3 forks source link

App packaging issue: libc++.1.dylib not found #17

Closed GenevieveBuckley closed 6 years ago

GenevieveBuckley commented 6 years ago

Pyinstaller appears to build correctly (eg: outputs reasonnably sane looking files to dist/) but when you attempt to run the executable you get the error: "libc++.1.dylib not found". Full traceback below.

It seemed reasonably likely this had something to do with the newest version of Xcode (9.4) that came out yesterday, but after reverting to Xcode 9.3.1 I'm still seeing the same behaviour. Probable next step, try installing from source (http://libcxx.llvm.org/). EDIT: don't do this, you already have a working version of these libraries & could mess things up a lot by mucking around with it.

dyn-130-194-109-119:dist genevieb$ ./Podo
Traceback (most recent call last):
  File "bin/launch-gui.py", line 1, in <module>
  File "/Users/genevieb/anaconda/envs/podo/lib/python3.6/site-packages/PyInstaller/loader/pyimod03_importers.py", line 631, in exec_module
    exec(bytecode, module.__dict__)
  File "podocytes/main.py", line 10, in <module>
  File "/Users/genevieb/anaconda/envs/podo/lib/python3.6/site-packages/PyInstaller/loader/pyimod03_importers.py", line 631, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages/skimage/__init__.py", line 157, in <module>
  File "/Users/genevieb/anaconda/envs/podo/lib/python3.6/site-packages/PyInstaller/loader/pyimod03_importers.py", line 631, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages/skimage/util/__init__.py", line 12, in <module>
  File "/Users/genevieb/anaconda/envs/podo/lib/python3.6/site-packages/PyInstaller/loader/pyimod03_importers.py", line 631, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages/skimage/util/_montage.py", line 2, in <module>
  File "/Users/genevieb/anaconda/envs/podo/lib/python3.6/site-packages/PyInstaller/loader/pyimod03_importers.py", line 631, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages/skimage/exposure/__init__.py", line 1, in <module>
  File "/Users/genevieb/anaconda/envs/podo/lib/python3.6/site-packages/PyInstaller/loader/pyimod03_importers.py", line 631, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages/skimage/exposure/exposure.py", line 4, in <module>
  File "/Users/genevieb/anaconda/envs/podo/lib/python3.6/site-packages/PyInstaller/loader/pyimod03_importers.py", line 631, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages/skimage/color/__init__.py", line 1, in <module>
  File "/Users/genevieb/anaconda/envs/podo/lib/python3.6/site-packages/PyInstaller/loader/pyimod03_importers.py", line 631, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages/skimage/color/colorconv.py", line 369, in <module>
  File "site-packages/scipy/linalg/basic.py", line 946, in inv
  File "site-packages/scipy/_lib/_util.py", line 228, in _asarray_validated
  File "/Users/genevieb/anaconda/envs/podo/lib/python3.6/site-packages/PyInstaller/loader/pyimod03_importers.py", line 631, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages/scipy/sparse/__init__.py", line 229, in <module>
  File "/Users/genevieb/anaconda/envs/podo/lib/python3.6/site-packages/PyInstaller/loader/pyimod03_importers.py", line 631, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages/scipy/sparse/csr.py", line 15, in <module>
  File "/Users/genevieb/anaconda/envs/podo/lib/python3.6/site-packages/PyInstaller/loader/pyimod03_importers.py", line 714, in load_module
    module = loader.load_module(fullname)
ImportError: dlopen(/var/folders/gz/6f0v_zhs09x38mb4td_h6py80000gn/T/_MEIrRvnVH/scipy.sparse._sparsetools.so, 2): Library not loaded: @loader_path/libc++.1.dylib
  Referenced from: /var/folders/gz/6f0v_zhs09x38mb4td_h6py80000gn/T/_MEIrRvnVH/libc++.1.dylib
  Reason: image not found
[82659] Failed to execute script launch-gui

Cannot begin work on https://github.com/monashmicroimaging/podocytes/issues/15 or https://github.com/monashmicroimaging/podocytes/issues/14 until this is resolved.

GenevieveBuckley commented 6 years ago

What caused the problem

At one point I had a local untracked file in the repository that contained the line import scipy.sparse.

What the fix was

  1. Removing the file containing import scipy.sparse from the repository.
  2. Deleting the conda environment entirely. Somewhere, somehow there were some cached files left behind, you can't just pip uninstall podocytes, or just reinstall pyinstaller. Nope! I had to go scorched earth here.
  3. Create a (new) podo conda environment. Now you can reinstall podocytes with pip install -e . and then run `pyinstaller Podo.spec'

Things that didn't help

GenevieveBuckley commented 6 years ago

@jni if you definitely want to use some of the gala evaluate functions (the ones importing scipy.sparse) I think editing the Podo.spec file a.binaries to also include the libc++ path will do the trick (see lines 81 - 84).

I'm not entirely convinced we need to use this, but I'll leave this issue open so we can discuss.

jni commented 6 years ago

@GenevieveBuckley actually I want to use these for our own tweaking, not inside the app, so I think we are good!

GenevieveBuckley commented 6 years ago

Ok then, we're good here.