[MacPorts] #63492: py37-openslide @1.1.2_1: OSError: dlopen(libopenslide.0.dylib, 6): image not found (was: openslide @3.4.1_1 (active) py37-openslide @1.1.2_1 (active) Using python3.7.)
MacPorts
noreply at macports.org
Wed Sep 15 17:13:35 UTC 2021
#63492: py37-openslide @1.1.2_1: OSError: dlopen(libopenslide.0.dylib, 6): image
not found
--------------------------------------+----------------------
Reporter: DavidBAEpstein | Owner: bgilbert
Type: defect | Status: assigned
Priority: Normal | Milestone:
Component: ports | Version: 2.7.1
Resolution: | Keywords:
Port: openslide, py-openslide |
--------------------------------------+----------------------
Changes (by ryandesign):
* status: new => assigned
* priority: High => Normal
* owner: (none) => bgilbert
* port: openslide, py37-openslide => openslide, py-openslide
Old description:
> virtual environment created with
> conda create -n openslide_bug python=3.7
>
> python command import openslide fails
>
> Attaching files with descriptive names
>
> MacBook Pro (Retina, 15-inch, Mid 2015)
> Macos 11.5.2
New description:
virtual environment created with
{{{
conda create -n openslide_bug python=3.7
}}}
python command import openslide fails
Attaching files with descriptive names
MacBook Pro (Retina, 15-inch, Mid 2015)\\
Macos 11.5.2
--
Comment:
The error shown in the first attached file is:
{{{
OSError: dlopen(libopenslide.0.dylib, 6): image not found
}}}
Does /opt/local/lib/libopenslide.0.dylib exist? If so, what's the output
of `otool -L /opt/local/lib/libopenslide.0.dylib`? What I'm looking for is
whether the second line of output lists the full library path as it should
(/opt/local/lib/libopenslide.0.dylib) or just its name
(libopenslide.0.dylib). Our binary packages of openslide look like they
have the correct full library path.
dlopen probably needs a full path to the library file to work, but the
error message only listed the library name. Looking closer at the error
message, I see that the problem is probably here:
{{{
File "/Users/dbae/opt/anaconda3/envs/openslide_bug/lib/python3.7/site-
packages/openslide/lowlevel.py", line 46, in <module>
_lib = cdll.LoadLibrary('libopenslide.0.dylib')
}}}
Looks like py-openslide's code explicitly calls
`cdll.LoadLibrary('libopenslide.0.dylib')`. Presumably that will need to
be changed to use the absolute library path, i.e.
`cdll.LoadLibrary('/opt/local/lib/libopenslide.0.dylib')`.
The code in lowlevel.py reads:
{{{
elif platform.system() == 'Darwin':
try:
_lib = cdll.LoadLibrary('libopenslide.0.dylib')
except OSError:
# MacPorts doesn't add itself to the dyld search path, but
# does add itself to the find_library() search path
# (DEFAULT_LIBRARY_FALLBACK in ctypes.macholib.dyld) on
# Python 2.6 and 2.7. Python 3 users on MacPorts should add
# the MacPorts lib directory to DYLD_LIBRARY_PATH.
import ctypes.util
_lib = ctypes.util.find_library('openslide')
if _lib is None:
raise ImportError("Couldn't locate OpenSlide dylib. " +
"Is OpenSlide installed?")
_lib = cdll.LoadLibrary(_lib)
}}}
The advice in those comments seems terrible to me: users should most
certainly not add the MacPorts lib directory to DYLD_LIBRARY_PATH; that
will break immense numbers of things. The developers of py-openslide
should fix their software so that that's not necessary.
--
Ticket URL: <https://trac.macports.org/ticket/63492#comment:2>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list