You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Since v21.06.00, cuCIM silenced ImportError exception from from .clara import CuImage, __version__, cli
to support cucim.skimage package-only use case.
try:
importcupyexceptImportError:
passtry:
from .claraimportCuImage, __version__, cliexceptImportError:
from ._versionimportget_versions__version__=get_versions()['version']
delget_versionsdel_version
That caused an issue on MONAI's tests because it wouldn't raise ImportError even if loading libcucim.so was failed, and it causes MONAI's optional_import() method to return True.
MONAI team (@wyli@drbeh) has the following workaround to check cucim.CuImage's availability.
User may want to see error when import cucim if cucim.CuImage is not available.
Environment details (please complete the following information):
Environment location: Docker
Method of cuCIM install: PyPI
Additional context
We may want to expose a method in (cucim package) to to check if image loader(cucim.clara) or image processor(cucim.skimage, cucim.core) are available so that user can check the real availability.
such as:
cucim.is_available() : check if all modules are available.
cucim.is_available("clara") : check if image loader-related modules are available.
cucim.is_available("skimage")
cucim.is_available("core")
The text was updated successfully, but these errors were encountered:
)
- Add `cucim.is_available()` method
Users can query if a specific module is available or not.
For example, if cucim.clara module which requires C shared library is not available:
```
>>> import cucim
>>> cucim.is_available()
False
>>> cucim.is_available("skimage")
True
>>> cucim.is_available("core")
True
>>> cucim.is_available("clara")
False
```
Resolves#104
Supports Project-MONAI/MONAI#2987
Authors:
- Gigon Bae (https://github.com/gigony)
Approvers:
- Gregory R. Lee (https://github.com/grlee77)
- https://github.com/jakirkham
URL: #107
Describe the bug
Since v21.06.00, cuCIM silenced ImportError exception from
from .clara import CuImage, __version__, cli
to support
cucim.skimage
package-only use case.cucim/python/cucim/src/cucim/__init__.py
Line 44 in 3afa154
That caused an issue on MONAI's tests because it wouldn't raise ImportError even if loading libcucim.so was failed, and it causes MONAI's optional_import() method to return
True
.MONAI team (@wyli @drbeh) has the following workaround to check
cucim.CuImage
's availability.drbeh/MONAI@a102ab7#diff-fcffca442c7cee4391ab58c3d2b71b80134da7621262457c69a3741308e156cd
Steps/Code to reproduce bug
import cucim
img = cucim.CuImage("input.tif")
Expected behavior
import cucim
if cucim.CuImage is not available.Environment details (please complete the following information):
Additional context
We may want to expose a method in (
cucim
package) to to check if image loader(cucim.clara) or image processor(cucim.skimage, cucim.core) are available so that user can check the real availability.cucim.is_available()
: check if all modules are available.cucim.is_available("clara")
: check if image loader-related modules are available.cucim.is_available("skimage")
cucim.is_available("core")
The text was updated successfully, but these errors were encountered: