Skip to content

Conversation

SachidanandAlle
Copy link

Currently user has to copy libopenslide-0.dll into system folder. If user has downloaded the openslide zip and added the openslide/bin to PATH, it fails to load libopenslide-0.dll.
Hence better to use find_library to find and load the dll file for windows as well.

Currently user has to copy libopenslide-0.dll into system folder.  If user has downloaded the openslide zip and added the openslide/bin to PATH, it fails to load `libopenslide-0.dll`.
Hence better to use find_library to find and load the dll file for windows as well.
@bgilbert
Copy link
Member

bgilbert commented Mar 6, 2022

On Python 3.8 and above, use this code to specify the directory containing libopenslide-0.dll:

import os
with os.add_dll_directory(r'c:\path\to\openslide\directory'):
    import openslide

For more info, see #115 and #150.

@bgilbert bgilbert closed this Mar 6, 2022
@SachidanandAlle
Copy link
Author

SachidanandAlle commented Mar 6, 2022

so user can not use PIP package directly on windows.. like me, others have to add/modify something more to continue.. i mean user have to write extra lines on top to handle this error...

i am fine with any solution that makes usage little simplified without doing any top-up code to use OpenSlide Python on windows. specially not comfortable of using/hardcoding the dir path for openslide inside python code..

@SachidanandAlle SachidanandAlle deleted the patch-1 branch March 6, 2022 22:08
@bgilbert
Copy link
Member

bgilbert commented Mar 6, 2022

You should still be able to use pip to install OpenSlide Python. You just need an additional line before the import statement. This isn't unique to OpenSlide Python; it's a Python policy change in ≥ 3.8 to tighten the security rules for loading DLLs.

You don't need to hardcode the path if you don't want to. You can read the path from an environment variable or a config file, or use a path calculated from the path of your Python module.

@j-sieger
Copy link

j-sieger commented Mar 29, 2022

On Python 3.8 and above, use this code to specify the directory containing libopenslide-0.dll:

import os
with os.add_dll_directory(r'c:\path\to\openslide\directory'):
    import openslide

For more info, see #115 and #150.

@SachidanandAlle
I am facing the same issue on Amazon linux2(EC2) while starting the MONAILalbel App. I need 'libopenslide.so.0' file. I am not able find .so file in my system path to add the path like you edited the lowlevel.py file.

Can you please help me here.

@j-sieger
Copy link

On Python 3.8 and above, use this code to specify the directory containing libopenslide-0.dll:

import os
with os.add_dll_directory(r'c:\path\to\openslide\directory'):
    import openslide

For more info, see #115 and #150.

@bgilbert :
What is the path here to find libopenslide.so.0 file. I could not find any .so file in the system paths. I was able find .dll from here (https://openslide.org/download/) but no so files here as well.

@bgilbert
Copy link
Member

bgilbert commented Mar 30, 2022

@j-sieger OpenSlide Python requires OpenSlide. If it's not packaged in your distribution, you'll need to install from source.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants