From jon.sauer at gmail.com Tue Sep 5 07:46:57 2023 From: jon.sauer at gmail.com (Jon Sauer) Date: Tue, 5 Sep 2023 07:46:57 -0400 Subject: openslide on Apple silicon? In-Reply-To: <2153E73A-4EAA-43A9-8994-A2B65B738715@gmail.com> References: <203284A6-C39C-4292-98EB-5F1701678AA6@gmail.com> <0416A8DE-32D6-46B3-82C1-EFCA09997B74@gmail.com> <2153E73A-4EAA-43A9-8994-A2B65B738715@gmail.com> Message-ID: <77EB900E-AE6A-4E02-A7D1-99E6ADF29700@gmail.com> Hi, After struggling for over a day using ?port? to uninstall and subsequentialy install packages revealed using 'sudo port install openslide?, it finally failed installing ?llvm-3.5?: ---> Found 102 broken files, matching files to ports Warning: No port llvm-3.5 found in the index; can't rebuild ---> Broken files found, but all associated ports are not in the index and so cannot be rebuilt. ?pip? also can?t install openslide. So installed Miniconda. It seemed to install openslide OK but ?import openslide? fails as below: I don?t want to struggle finding another way to read .svs files, so I?m hoping there is something that can be done to make openslide operational on my Mac Studio initially cloned from an Intel MacBook Pro. ?brew? was reinstalled and used to install python 3.11. # ----------------------------------------------------------------- (dl4cv) sauer : Sep_2023_dev $ python3 Python 3.11.5 (main, Aug 24 2023, 15:09:45) [Clang 14.0.3 (clang-1403.0.22.14.1)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import openslide Traceback (most recent call last): File "/opt/homebrew/lib/python3.11/site-packages/openslide/lowlevel.py", line 74, in _load_library return try_load(['libopenslide.1.dylib', 'libopenslide.0.dylib']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/openslide/lowlevel.py", line 58, in try_load return cdll.LoadLibrary(name) ^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/python at 3.11/3.11.5/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ctypes/__init__.py", line 454, in LoadLibrary return self._dlltype(name) ^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/python at 3.11/3.11.5/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), '/opt/homebrew/Cellar/python at 3.11/3.11.5/Frameworks/Python.framework/Versions/3.11/Resources/Python.app/Contents/MacOS/../../../../../../../../../../../lib/libopenslide.0.dylib' (no such file), '/usr/lib/libopenslide.0.dylib' (no such file, not in dyld cache), 'libopenslide.0.dylib' (no such file), '/usr/local/lib/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 "", line 1, in File "/opt/homebrew/lib/python3.11/site-packages/openslide/__init__.py", line 31, in from openslide import lowlevel File "/opt/homebrew/lib/python3.11/site-packages/openslide/lowlevel.py", line 92, in _lib = _load_library() ^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/openslide/lowlevel.py", line 83, in _load_library raise ModuleNotFoundError( ModuleNotFoundError: Couldn't locate OpenSlide dylib. Is OpenSlide installed correctly? https://openslide.org/api/python/#installing >>> # ----------------------------------------------------------------- Cheers, Jon > On Aug 31, 2023, at 2:53 PM, Jon Sauer wrote: > > Hi Benjamin, > > Yes indeed, my whole environment on the new Mac Studio was migrated from my old 15? 2016 MacBook Pro, an x86_64 machine just as you surmised. > > Many, many thanks. I?ll make the necessay changes, only mention something again if I can?t make it work. > > Thanks again. > > Cheers, > Jon > > Jon.Sauer at gmail.com > cell: +1.303.579.3009 > White River Junction, VT, USA > > >> On Aug 31, 2023, at 12:34 PM, Benjamin Gilbert wrote: >> >> On Thu, Aug 31, 2023 at 11:32?AM Jon Sauer wrote: >>> 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?)) >> >> OpenSlide Python found your Homebrew copy of OpenSlide in /usr/local, >> but couldn't load it because it's an x86_64 binary instead of an arm64 >> binary. On ARM, Homebrew installs into /opt/homebrew instead. Is it >> possible that your Homebrew installation was migrated from a previous >> x86_64 machine? You might consider removing and reinstalling Homebrew >> so you have native ARM binaries. That should also fix the error >> you're seeing. >> >> --Benjamin Gilbert > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jcupitt at gmail.com Tue Sep 5 13:11:50 2023 From: jcupitt at gmail.com (jcupitt at gmail.com) Date: Tue, 5 Sep 2023 18:11:50 +0100 Subject: openslide on Apple silicon? In-Reply-To: <77EB900E-AE6A-4E02-A7D1-99E6ADF29700@gmail.com> References: <203284A6-C39C-4292-98EB-5F1701678AA6@gmail.com> <0416A8DE-32D6-46B3-82C1-EFCA09997B74@gmail.com> <2153E73A-4EAA-43A9-8994-A2B65B738715@gmail.com> <77EB900E-AE6A-4E02-A7D1-99E6ADF29700@gmail.com> Message-ID: I tried on my M2 mac mini and it seemed to work well with brew. I have brew like this: john at cheese ~/try $ echo $PATH /Users/john/vips/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:... etc.Z And I've put openslide, python and pip on like this: john at cheese ~/try $ brew install openslide Warning: openslide 3.4.1_8 is already installed and up-to-date. To reinstall 3.4.1_8, run: brew reinstall openslide john at cheese ~/try $ which pip /opt/homebrew/bin/pip john at cheese ~/try $ which python3 /opt/homebrew/bin/python3 I then installed openslide-python with pip: john at cheese ~/try $ pip install openslide-python Collecting openslide-python Downloading openslide-python-1.3.0.tar.gz (358 kB) ??????????????????????????????????????? 358.9/358.9 kB 6.0 MB/s eta 0:00:00 Preparing metadata (setup.py) ... done Collecting Pillow (from openslide-python) Obtaining dependency information for Pillow from https://files.pythonhosted.org/packages/b7/ad/71982d18fd28ed1f93c31b8648f980ebdbdbcf7d8c9c9b4af59290914ce9/Pillow-10.0.0-cp311-cp311-macosx_11_0_arm64.whl.metadata Downloading Pillow-10.0.0-cp311-cp311-macosx_11_0_arm64.whl.metadata (9.5 kB) Downloading Pillow-10.0.0-cp311-cp311-macosx_11_0_arm64.whl (3.1 MB) ???????????????????????????????????????? 3.1/3.1 MB 4.9 MB/s eta 0:00:00 Building wheels for collected packages: openslide-python Building wheel for openslide-python (setup.py) ... done Created wheel for openslide-python: filename=openslide_python-1.3.0-cp311-cp311-macosx_13_0_arm64.whl size=26428 sha256=e79d62ff8af5eadb9c3c26495448012dbcae458e411b47a4a86067033a47fc0c Stored in directory: /Users/john/Library/Caches/pip/wheels/75/f2/b4/8a416a8f3c107db18b12d6255bcc00e4d6aa589d538395207c Successfully built openslide-python Installing collected packages: Pillow, openslide-python Successfully installed Pillow-10.0.0 openslide-python-1.3.0 And I could now import openslide: john at cheese ~/try $ python3 Python 3.11.5 (main, Aug 24 2023, 15:09:45) [Clang 14.0.3 (clang-1403.0.22.14.1)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import openslide >>> Hope this helps, John From jon.sauer at gmail.com Tue Sep 5 15:30:41 2023 From: jon.sauer at gmail.com (Jon Sauer) Date: Tue, 5 Sep 2023 15:30:41 -0400 Subject: openslide on Apple silicon? In-Reply-To: References: <203284A6-C39C-4292-98EB-5F1701678AA6@gmail.com> <0416A8DE-32D6-46B3-82C1-EFCA09997B74@gmail.com> <2153E73A-4EAA-43A9-8994-A2B65B738715@gmail.com> <77EB900E-AE6A-4E02-A7D1-99E6ADF29700@gmail.com> Message-ID: Hi John, Many, many thanks. Things worked similarly to your setup after I moved # ------------ below ------------ # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 230809 ~0940 # https://towardsdatascience.com/the-ultimate-python-and-tensorflow-set-up-guide-for-apple-silicon-macs-m1-m2-e9ef304a2c06 # # homebrew setup, following https://noahpeeters.de/posts/apple-silicon/homebrew-setup/ # if [ -d "/opt/homebrew/bin" ]; then export PATH="/opt/homebrew/bin:$PATH" fi # ------------ above ?????? from .bashrc to .bash_profile. I don?t understand why PATH didn?t contain /opt/homebrew/bin earlier but it does now. Again, many thanks. Cheers, Jon Jon.Sauer at gmail.com cell: +1.303.579.3009 White River Junction, VT, USA > On Sep 5, 2023, at 1:11 PM, jcupitt at gmail.com wrote: > > I tried on my M2 mac mini and it seemed to work well with brew. > > I have brew like this: > > john at cheese ~/try $ echo $PATH > /Users/john/vips/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:... > etc.Z > > And I've put openslide, python and pip on like this: > > john at cheese ~/try $ brew install openslide > Warning: openslide 3.4.1_8 is already installed and up-to-date. > To reinstall 3.4.1_8, run: > brew reinstall openslide > john at cheese ~/try $ which pip > /opt/homebrew/bin/pip > john at cheese ~/try $ which python3 > /opt/homebrew/bin/python3 > > I then installed openslide-python with pip: > > john at cheese ~/try $ pip install openslide-python > Collecting openslide-python > Downloading openslide-python-1.3.0.tar.gz (358 kB) > ??????????????????????????????????????? 358.9/358.9 kB 6.0 MB/s eta 0:00:00 > Preparing metadata (setup.py) ... done > Collecting Pillow (from openslide-python) > Obtaining dependency information for Pillow from > https://files.pythonhosted.org/packages/b7/ad/71982d18fd28ed1f93c31b8648f980ebdbdbcf7d8c9c9b4af59290914ce9/Pillow-10.0.0-cp311-cp311-macosx_11_0_arm64.whl.metadata > Downloading Pillow-10.0.0-cp311-cp311-macosx_11_0_arm64.whl.metadata (9.5 kB) > Downloading Pillow-10.0.0-cp311-cp311-macosx_11_0_arm64.whl (3.1 MB) > ???????????????????????????????????????? 3.1/3.1 MB 4.9 MB/s eta 0:00:00 > Building wheels for collected packages: openslide-python > Building wheel for openslide-python (setup.py) ... done > Created wheel for openslide-python: > filename=openslide_python-1.3.0-cp311-cp311-macosx_13_0_arm64.whl > size=26428 sha256=e79d62ff8af5eadb9c3c26495448012dbcae458e411b47a4a86067033a47fc0c > Stored in directory: > /Users/john/Library/Caches/pip/wheels/75/f2/b4/8a416a8f3c107db18b12d6255bcc00e4d6aa589d538395207c > Successfully built openslide-python > Installing collected packages: Pillow, openslide-python > Successfully installed Pillow-10.0.0 openslide-python-1.3.0 > > And I could now import openslide: > > john at cheese ~/try $ python3 > Python 3.11.5 (main, Aug 24 2023, 15:09:45) [Clang 14.0.3 > (clang-1403.0.22.14.1)] on darwin > Type "help", "copyright", "credits" or "license" for more information. >>>> import openslide >>>> > > Hope this helps, > > John -------------- next part -------------- An HTML attachment was scrubbed... URL: