Error import openslide
Finn Benned Hansen
finn.hansen at sund.ku.dk
Wed Jan 24 09:53:02 EST 2024
Hi Benjamin,
Thnx for your response.
I am having the issue when using PaperSpace Gradient.
Here the Ubuntu version info is:
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.4 LTS"
NAME="Ubuntu"
VERSION="20.04.4 LTS (Focal Fossa)"
.and python version 3.9.13
In /usr/lib/python3/dist-packages I do indeed find openslide and openslide_python-1.3.1.egg-info, and nothing similar in /usr/lib/python3.9.
A subsequent pip install openslide-python does not help. Any suggestions to do this from command line? Like downgrading to python 3.8?
On a couple of different platforms (hosted by a Danish university) openslide imports successfully and runs perfectly. These use Ubuntu 22.04.3 LTS x86_64 and Python 3.10.12
Best,
Finn
Finn Benned Hansen
Gæsteforsker
Københavns Universitet
Biomedicinsk Institut
Blegdamsvej 3
København N.
finn.hansen at sund.ku.dk<mailto:finn.hansen at sund.ku.dk>
[Logo for Københavns Universitet]
Sådan beskytter vi persondata<https://informationssikkerhed.ku.dk/persondatabeskyttelse/privatlivspolitik/>
From: Benjamin Gilbert <bgilbert+openslide at cs.cmu.edu>
Sent: 23. januar 2024 18:13
To: Finn Benned Hansen <finn.hansen at sund.ku.dk>
Cc: openslide-users at lists.andrew.cmu.edu
Subject: Re: Error import openslide
Du får ikke ofte mails fra bgilbert+openslide at cs.cmu.edu<mailto:bgilbert+openslide at cs.cmu.edu>. Få mere at vide om, hvorfor dette er vigtigt<https://aka.ms/LearnAboutSenderIdentification>
On Tue, Jan 23, 2024 at 10:28 AM Finn Benned Hansen <finn.hansen at sund.ku.dk<mailto:finn.hansen at sund.ku.dk>> wrote:
Used below to install Openslide and python3-openslide as described @ https://launchpad.net/~openslide/+archive/ubuntu/openslide<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/20240124/7b965277/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 5568 bytes
Desc: image001.png
URL: <http://lists.andrew.cmu.edu/pipermail/openslide-users/attachments/20240124/7b965277/attachment-0001.png>
More information about the openslide-users
mailing list