Error import openslide
Benjamin Gilbert
bgilbert+openslide at cs.cmu.edu
Tue Jan 23 12:12:37 EST 2024
On Tue, Jan 23, 2024 at 10:28 AM Finn Benned Hansen <finn.hansen at sund.ku.dk>
wrote:
> Used below to install Openslide and python3-openslide as described @
> https://launchpad.net/~openslide/+archive/ubuntu/openslide:
>
>
> When trying to ‘import openslide’ in a python 3.9.13 environment I get the
> following error message:
>
>
> *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)*
>
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.
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.
Best,
--Benjamin Gilbert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.andrew.cmu.edu/pipermail/openslide-users/attachments/20240123/38eb0a68/attachment.html>
More information about the openslide-users
mailing list