<div dir="ltr"><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jan 23, 2024 at 10:28 AM Finn Benned Hansen <<a href="mailto:finn.hansen@sund.ku.dk">finn.hansen@sund.ku.dk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="msg1179147675609757964">





<div lang="EN-US">
<div class="m_6882363853056735808WordSection1">
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Verdana",sans-serif">Used below to install Openslide and python3-openslide as described @ <a href="https://launchpad.net/~openslide/+archive/ubuntu/openslide" target="_blank">https://launchpad.net/~openslide/+archive/ubuntu/openslide</a>:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Verdana",sans-serif"><u></u> <u></u></span></p><span style="font-size:10pt;font-family:"Verdana",sans-serif">When trying to ‘import openslide’ in a python 3.9.13 environment I get the following error message:</span>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Verdana",sans-serif"><u></u> <u></u></span></p><i><span style="font-size:10pt;font-family:"Verdana",sans-serif;color:red">ImportError: cannot import name '_convert' from partially initialized module 'openslide' (most likely due to a circular import) (/usr/lib/python3/dist-packages/openslide/__init__.py)</span></i></div></div></div></blockquote><div><br></div><div>You don't say what Ubuntu version you're using, but I'd guess that you're trying to use a Python version that isn't the Ubuntu default.  Is that correct?  The compiled binary for openslide._convert is included in the .deb package, but because of how C extension modules work, it will only load on the Python 3.Y version it was compiled for.  However, Python .debs always install into the unversioned /usr/lib/python3/dist-packages directory, not a versioned /usr/lib/python3.9, so the package import finds the pure Python code but fails to load the extension module.</div><div><br></div>If you need to use a non-default version of Python, you should probably just install OpenSlide Python with pip.  The upcoming OpenSlide Python 1.4.0 will include binary wheels for Linux, but for now, you'll need GCC and Python headers installed.</div><div class="gmail_quote"><br></div><div class="gmail_quote">Best,</div><div class="gmail_quote">--Benjamin Gilbert</div><div class="gmail_quote"><br></div></div>