openslide on Apple silicon?

Jon Sauer jon.sauer at gmail.com
Thu Aug 31 11:27:11 EDT 2023


first, to guarantee a clean start, I execute the following in the shell:
# ----------------------
cd ~
date
python3 --version

python3 -u -m pip uninstall numpy
python3 -u -m pip uninstall openslide-python

python3 -u -m pip install numpy | tee install_numpy.log
python3 -u -m pip install openslide-python | tee install_openslide.log
# ———————————

the result was:

Successfully installed openslide-python-1.3.0

Then, trying to ‘import openslide’ from ‘python’ gives an immediate error:

(dl4cv) sauer : ~ $ python3 --version
Python 3.11.4
(dl4cv) sauer : ~ $ python3
Python 3.11.4 (v3.11.4:d2340ef257, Jun  6 2023, 19:15:51) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import openslide
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/openslide/lowlevel.py", line 74, in _load_library
    return try_load(['libopenslide.1.dylib', 'libopenslide.0.dylib'])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/openslide/lowlevel.py", line 58, in try_load
    return cdll.LoadLibrary(name)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ctypes/__init__.py", line 454, in LoadLibrary
    return self._dlltype(name)
           ^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ctypes/__init__.py", line 376, in __init__
    self._handle = _dlopen(self._name, mode)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: dlopen(libopenslide.0.dylib, 0x0006): tried: 'libopenslide.0.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibopenslide.0.dylib' (no such file), '/usr/lib/libopenslide.0.dylib' (no such file, not in dyld cache), 'libopenslide.0.dylib' (no such file), '/usr/lib/libopenslide.0.dylib' (no such file, not in dyld cache)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/openslide/__init__.py", line 31, in <module>
    from openslide import lowlevel
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/openslide/lowlevel.py", line 92, in <module>
    _lib = _load_library()
           ^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/openslide/lowlevel.py", line 87, in _load_library
    return cdll.LoadLibrary(lib)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ctypes/__init__.py", line 454, in LoadLibrary
    return self._dlltype(name)
           ^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ctypes/__init__.py", line 376, in __init__
    self._handle = _dlopen(self._name, mode)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: dlopen(/usr/local/lib/libopenslide.dylib, 0x0006): tried: '/usr/local/lib/libopenslide.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/lib/libopenslide.dylib' (no such file), '/usr/local/lib/libopenslide.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/usr/local/Cellar/openslide/3.4.1_7/lib/libopenslide.0.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/Cellar/openslide/3.4.1_7/lib/libopenslide.0.dylib' (no such file), '/usr/local/Cellar/openslide/3.4.1_7/lib/libopenslide.0.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64’))u
(dl4cv) sauer : ~ $ python3 --version
Python 3.11.4
(dl4cv) sauer : ~ $ python3
Python 3.11.4 (v3.11.4:d2340ef257, Jun  6 2023, 19:15:51) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import openslide
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/openslide/lowlevel.py", line 74, in _load_library
    return try_load(['libopenslide.1.dylib', 'libopenslide.0.dylib'])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/openslide/lowlevel.py", line 58, in try_load
    return cdll.LoadLibrary(name)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ctypes/__init__.py", line 454, in LoadLibrary
    return self._dlltype(name)
           ^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ctypes/__init__.py", line 376, in __init__
    self._handle = _dlopen(self._name, mode)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: dlopen(libopenslide.0.dylib, 0x0006): tried: 'libopenslide.0.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibopenslide.0.dylib' (no such file), '/usr/lib/libopenslide.0.dylib' (no such file, not in dyld cache), 'libopenslide.0.dylib' (no such file), '/usr/lib/libopenslide.0.dylib' (no such file, not in dyld cache)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/openslide/__init__.py", line 31, in <module>
    from openslide import lowlevel
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/openslide/lowlevel.py", line 92, in <module>
    _lib = _load_library()
           ^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/openslide/lowlevel.py", line 87, in _load_library
    return cdll.LoadLibrary(lib)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ctypes/__init__.py", line 454, in LoadLibrary
    return self._dlltype(name)
           ^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ctypes/__init__.py", line 376, in __init__
    self._handle = _dlopen(self._name, mode)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: dlopen(/usr/local/lib/libopenslide.dylib, 0x0006): tried: '/usr/local/lib/libopenslide.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/lib/libopenslide.dylib' (no such file), '/usr/local/lib/libopenslide.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/usr/local/Cellar/openslide/3.4.1_7/lib/libopenslide.0.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/Cellar/openslide/3.4.1_7/lib/libopenslide.0.dylib' (no such file), '/usr/local/Cellar/openslide/3.4.1_7/lib/libopenslide.0.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64’))
# ---------------------------------

> On Aug 31, 2023, at 12:58 AM, Benjamin Gilbert <bgilbert at cs.cmu.edu> wrote:
> 
> On Wed, Aug 30, 2023 at 3:50 PM Adam Goode <adam at spicenitz.org> wrote:
>> Did you have a working setup on a previous Intel-based Mac?
> 
> I second that question.  From OpenSlide's perspective there isn't
> anything special about ARM Macs.  Jon, is there a specific problem
> you're encountering?
> 
> --Benjamin Gilbert



More information about the openslide-users mailing list