[cctbxbb] DYLD_FALLBACK_LIBRARY_PATH

Winter, Graeme (DLSLtd,RAL,LSCI) Graeme.Winter at diamond.ac.uk
Wed Dec 15 23:03:54 PST 2021


Hi Billy

Sorry for the slow response - needed to be near the right computer & currently bouncing between office and home for work

Rebuilt base to give a clean starting point, on default Python (3.9) -> this is the package list


I conda install -c c-f napari’d - getting me to here -


Then

silver-surfer viewer :) $ dials.python viewer.py /Users/graeme/data/i04-1-2021-run3-ins/Insulin_6_2.nxs
Traceback (most recent call last):
  File "/Users/graeme/work/viewer/viewer.py", line 24, in <module>
    viewer = napari.view_image(d, title="DIALS Image Viewer",
  File "/Users/graeme/git/dials/conda_base/lib/python3.9/site-packages/napari/_lazy.py", line 47, in __getattr__
    submod = import_module(f'{module_name}.{attr_to_modules[name]}')
  File "/Users/graeme/git/dials/conda_base/python.app/Contents/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/Users/graeme/git/dials/conda_base/lib/python3.9/site-packages/napari/view_layers.py", line 17, in <module>
    from .viewer import Viewer
  File "/Users/graeme/git/dials/conda_base/lib/python3.9/site-packages/napari/viewer.py", line 5, in <module>
    from .components.viewer_model import ViewerModel
  File "/Users/graeme/git/dials/conda_base/lib/python3.9/site-packages/napari/components/__init__.py", line 19, in <module>
    from .layerlist import LayerList
  File "/Users/graeme/git/dials/conda_base/lib/python3.9/site-packages/napari/components/layerlist.py", line 8, in <module>
    from ..layers import Image, Labels, Layer
  File "/Users/graeme/git/dials/conda_base/lib/python3.9/site-packages/napari/layers/__init__.py", line 12, in <module>
    from .image import Image
  File "/Users/graeme/git/dials/conda_base/lib/python3.9/site-packages/napari/layers/image/__init__.py", line 1, in <module>
    from .image import Image
  File "/Users/graeme/git/dials/conda_base/lib/python3.9/site-packages/napari/layers/image/image.py", line 12, in <module>
    from ...utils import config
  File "/Users/graeme/git/dials/conda_base/lib/python3.9/site-packages/napari/utils/config.py", line 5, in <module>
    from ._octree import get_octree_config
  File "/Users/graeme/git/dials/conda_base/lib/python3.9/site-packages/napari/utils/_octree.py", line 11, in <module>
    from ..settings import get_settings
  File "/Users/graeme/git/dials/conda_base/lib/python3.9/site-packages/napari/settings/__init__.py", line 6, in <module>
    from ._napari_settings import NapariSettings
  File "/Users/graeme/git/dials/conda_base/lib/python3.9/site-packages/napari/settings/_napari_settings.py", line 9, in <module>
    from ._appearance import AppearanceSettings
  File "/Users/graeme/git/dials/conda_base/lib/python3.9/site-packages/napari/settings/_appearance.py", line 4, in <module>
    from ..utils.theme import available_themes
  File "/Users/graeme/git/dials/conda_base/lib/python3.9/site-packages/napari/utils/theme.py", line 20, in <module>
    from .._vendor import darkdetect
  File "/Users/graeme/git/dials/conda_base/lib/python3.9/site-packages/napari/_vendor/darkdetect/__init__.py", line 17, in <module>
    from ._mac_detect import *
  File "/Users/graeme/git/dials/conda_base/lib/python3.9/site-packages/napari/_vendor/darkdetect/_mac_detect.py", line 18, in <module>
    objc = ctypes.cdll.LoadLibrary('libobjc.dylib')
  File "/Users/graeme/git/dials/conda_base/python.app/Contents/lib/python3.9/ctypes/__init__.py", line 460, in LoadLibrary
    return self._dlltype(name)
  File "/Users/graeme/git/dials/conda_base/python.app/Contents/lib/python3.9/ctypes/__init__.py", line 382, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(libobjc.dylib, 6): image not found

And

silver-surfer viewer :( $ cctbx.python -c "from napari import viewer"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "<frozen importlib._bootstrap>", line 1055, in _handle_fromlist
  File "/Users/graeme/git/dials/conda_base/lib/python3.9/site-packages/napari/_lazy.py", line 45, in __getattr__
    return import_module(f'{module_name}.{name}')
  File "/Users/graeme/git/dials/conda_base/python.app/Contents/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/Users/graeme/git/dials/conda_base/lib/python3.9/site-packages/napari/viewer.py", line 5, in <module>
    from .components.viewer_model import ViewerModel
  File "/Users/graeme/git/dials/conda_base/lib/python3.9/site-packages/napari/components/__init__.py", line 19, in <module>
    from .layerlist import LayerList
  File "/Users/graeme/git/dials/conda_base/lib/python3.9/site-packages/napari/components/layerlist.py", line 8, in <module>
    from ..layers import Image, Labels, Layer
  File "/Users/graeme/git/dials/conda_base/lib/python3.9/site-packages/napari/layers/__init__.py", line 12, in <module>
    from .image import Image
  File "/Users/graeme/git/dials/conda_base/lib/python3.9/site-packages/napari/layers/image/__init__.py", line 1, in <module>
    from .image import Image
  File "/Users/graeme/git/dials/conda_base/lib/python3.9/site-packages/napari/layers/image/image.py", line 12, in <module>
    from ...utils import config
  File "/Users/graeme/git/dials/conda_base/lib/python3.9/site-packages/napari/utils/config.py", line 5, in <module>
    from ._octree import get_octree_config
  File "/Users/graeme/git/dials/conda_base/lib/python3.9/site-packages/napari/utils/_octree.py", line 11, in <module>
    from ..settings import get_settings
  File "/Users/graeme/git/dials/conda_base/lib/python3.9/site-packages/napari/settings/__init__.py", line 6, in <module>
    from ._napari_settings import NapariSettings
  File "/Users/graeme/git/dials/conda_base/lib/python3.9/site-packages/napari/settings/_napari_settings.py", line 9, in <module>
    from ._appearance import AppearanceSettings
  File "/Users/graeme/git/dials/conda_base/lib/python3.9/site-packages/napari/settings/_appearance.py", line 4, in <module>
    from ..utils.theme import available_themes
  File "/Users/graeme/git/dials/conda_base/lib/python3.9/site-packages/napari/utils/theme.py", line 20, in <module>
    from .._vendor import darkdetect
  File "/Users/graeme/git/dials/conda_base/lib/python3.9/site-packages/napari/_vendor/darkdetect/__init__.py", line 17, in <module>
    from ._mac_detect import *
  File "/Users/graeme/git/dials/conda_base/lib/python3.9/site-packages/napari/_vendor/darkdetect/_mac_detect.py", line 18, in <module>
    objc = ctypes.cdll.LoadLibrary('libobjc.dylib')
  File "/Users/graeme/git/dials/conda_base/python.app/Contents/lib/python3.9/ctypes/__init__.py", line 460, in LoadLibrary
    return self._dlltype(name)
  File "/Users/graeme/git/dials/conda_base/python.app/Contents/lib/python3.9/ctypes/__init__.py", line 382, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(libobjc.dylib, 6): image not found

however

silver-surfer viewer :( $ which python3
/Users/graeme/git/dials/conda_base/bin/python3
silver-surfer viewer :) $ python3 -c "from napari import viewer"
silver-surfer viewer :) $

Following these instructions on macOS should reproduce the problem

https://dials.github.io/documentation/installation_developer.html

(with an additional conda install napari) - am running on Big Sur here.

I generated this email with fresh bootstrap -> should be reproducible

Thanks for any help you can offer!

Graeme



On 14 Dec 2021, at 19:15, Billy Poon <bkpoon at lbl.gov<mailto:bkpoon at lbl.gov>> wrote:

Hi Graeme,

The DYLD_FALLBACK_LIBRARY_PATH is prepended because we want cctbx libraries to come before any other user defined libraries when running cctbx code. Otherwise, there is no way to guarantee that any libraries that the user overrides in their environment will actually work with cctbx code.

Are you using conda? How did you construct your conda environment? You should be able to use "conda install napari" in your conda_base directory or some other conda environment that you use for building. Can you list your environment (i.e. conda list)? And the explicit one so that it can be reproduced (conda list -e --explicit --md5)? Also, steps to reproduce your build would be helpful in reproducing the error.

I tested "conda install -c conda-forge napari" in my Python 3.7 conda_base directory and the import works without any errors from cctbx.python.

--
Billy K. Poon
Research Scientist, Molecular Biophysics and Integrated Bioimaging
Lawrence Berkeley National Laboratory
1 Cyclotron Road, M/S 33R0345
Berkeley, CA 94720
Fax: (510) 486-5909
Web: https://phenix-online.org<https://phenix-online.org/>


On Tue, Dec 14, 2021 at 9:30 AM Winter, Graeme (DLSLtd,RAL,LSCI) <Graeme.Winter at diamond.ac.uk<mailto:Graeme.Winter at diamond.ac.uk>> wrote:
Hi Folks,

By default cctbx dispatchers on macOS clobber DYLD_FALLBACK_LIBRARY_PATH with some stuff which means that

from napari import viewer

fails with a huge stack trace ending in

OSError: dlopen(libobjc.dylib, 6): image not found

If I comment out the clobbering in the dispatcher then everything works fine so I am fairly sure this is the problem

Some questions -

 - why do we do this?
 - is there a way I can make a dispatcher not to this? or maybe leave the system DYLD… as it was and _append_ to rather than prepend?

Seems like a thing I am surprised I have not broken a toe on before now

Thanks Graeme



--
This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail.
Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd.
Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message.
Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom

_______________________________________________
cctbxbb mailing list
cctbxbb at phenix-online.org<mailto:cctbxbb at phenix-online.org>
http://phenix-online.org/mailman/listinfo/cctbxbb
_______________________________________________
cctbxbb mailing list
cctbxbb at phenix-online.org<mailto:cctbxbb at phenix-online.org>
http://phenix-online.org/mailman/listinfo/cctbxbb

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://phenix-online.org/pipermail/cctbxbb/attachments/20211216/9a6706c9/attachment.htm>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: conda-list-e.txt
URL: <http://phenix-online.org/pipermail/cctbxbb/attachments/20211216/9a6706c9/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: conda-list-e-napari.txt
URL: <http://phenix-online.org/pipermail/cctbxbb/attachments/20211216/9a6706c9/attachment-0001.txt>


More information about the cctbxbb mailing list