Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] There is no mechanism for user to know the availability of cucim.CuImage #104

Closed
gigony opened this issue Sep 22, 2021 · 0 comments · Fixed by #107
Closed

[BUG] There is no mechanism for user to know the availability of cucim.CuImage #104

gigony opened this issue Sep 22, 2021 · 0 comments · Fixed by #107
Assignees
Labels
feature request New feature or request
Milestone

Comments

@gigony
Copy link
Contributor

gigony commented Sep 22, 2021

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.

from .clara import CuImage, __version__, cli

try:
    import cupy
except ImportError:
    pass

try:
    from .clara import CuImage, __version__, cli
except ImportError:
    from ._version import get_versions
    __version__ = get_versions()['version']
    del get_versions
    del _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.

drbeh/MONAI@a102ab7#diff-fcffca442c7cee4391ab58c3d2b71b80134da7621262457c69a3741308e156cd

Steps/Code to reproduce bug

  • Install cuCIM v21.08.02 from PyPI
  • import cucim
  • img = cucim.CuImage("input.tif")

Expected behavior

  • 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")
@gigony gigony added the bug Something isn't working label Sep 22, 2021
@gigony gigony added this to the v21.10 milestone Sep 22, 2021
@gigony gigony self-assigned this Sep 22, 2021
@gigony gigony added feature request New feature or request and removed bug Something isn't working labels Sep 22, 2021
@rapids-bot rapids-bot bot closed this as completed in #107 Sep 30, 2021
rapids-bot bot pushed a commit that referenced this issue Sep 30, 2021
)

- 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant