Explain how to respond to the error message: loading openslide

Epstein, David David.Epstein at warwick.ac.uk
Mon Mar 28 12:40:11 UTC 2022

On 27 Mar 2022, at 00:55, Ryan Schmidt <ryandesign at macports.org<mailto:ryandesign at macports.org>> wrote:

Please direct all mailing list questions to the addresses at lists.macports.org<http://lists.macports.org>, not the older addresses that were deprecated in late 2016. I've fixed the address in this reply.

On Mar 26, 2022, at 04:54, Epstein, David wrote:

I am using MacPorts base version 2.7.2 under OS 11.6.4.
All my dealings with MacPorts is done using sudo
I got the following error:

When doing what?

45 try

---> 46     _lib = cdll.LoadLibrary('libopenslide.0.dylib')
    47 except OSError

    48     # MacPorts doesn't add itself to the dyld search path, but
    49     # does add itself to the find_library() search path
    50     # (DEFAULT_LIBRARY_FALLBACK in ctypes.macholib.dyld) on
    51     # Python 2.6 and 2.7.  Python 3 users on MacPorts should add
    52     # the MacPorts lib directory to DYLD_LIBRARY_PATH.

Q1 Where is DYLD_LIBRARY_PATH defined?
Q2 What is the official pathname of the “MacPorts lib directory”?
Q3 How should I have found the answers to the above two questions, without
bothering macports-users?

It would be nice if the standard MacPorts distribution dealt with this
problem so that I didn’t have to deal with it manually.

Normally, DYLD_LIBRARY_PATH should not be defined. It should only be set by a build system at very specific times when needed during the build. You should not need to set it after the build is done.

Sounds like whatever third-party software you're running here is under the mistaken belief that you should set DYLD_LIBRARY_PATH to some value when running their program. You should ask them to fix their program so that that is not necessary, because setting DYLD_LIBRARY_PATH other than at the very specific times I mentioned can cause unintended consequences. If they believe they need to set DYLD_LIBRARY_PATH because of some deficiency in MacPorts, they should be discussing that with us so that we can correct whatever the problem is.

If the software you're running was installed by a MacPorts port, we could patch it to fix the problem for them; if so, let us know what port it is.

The MacPorts library directory it's referring to would be whatever directory libopenslide.0.dylib is located in, which might be /opt/local/lib.

Thanks for the answers. The maintainer of macports openslide kindly wrote to me, basically to tell me that this is the same problem previously raised by me. (See https://trac.macports.org/ticket/63492). So, on the one hand, I shouldn’t have needed to write again, but, on the other hand, after the most recent exchange of emails, I now understand much better why I’m getting problems, and should not have to write a third time on the same issue. The error occurred when I was trying to load openslide, following somewhat complex instructions in a python package about creating a particular virtual environment. The python package instructions told me to “port install openslide”, but failed to say also to“port install py37-openslide”. I think that the version of py37-openslide in my virtual environment at that time actually came from pypi.  So now the error message makes sense to me, which I find reassuring. And it was subsequently easy to modify my virtual enviroment so that everything now works.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-users/attachments/20220328/0e2aba85/attachment.htm>

More information about the macports-users mailing list