clEsperanto / napari_pyclesperanto_assistant

GPU-accelerated general purpose image processing and image analysis in napari
http://clesperanto.net
BSD 3-Clause "New" or "Revised" License
32 stars 9 forks source link

plugin not visible while installed #43

Closed DirkRemmers closed 2 years ago

DirkRemmers commented 2 years ago

Hello,

First of all, this looks like a really cool tool, so I am looking forward to use it in my workflows! However, I can't seem to get it installed properly. I already attempted to get this to work on multiple machines, but I did not succeed. For the installation of my environment I use the following commands:

conda create --name napari-test python==3.8.5
conda activate napari-test
conda install -c conda-forge pyopencl
pip install napari-pyclesperanto-assistant
pip install "napari[all]"

As you can see, this is similar to the installation instructions. After this, I try to visualize an image using napari, either by calling napari via the terminal using napari, or by calling napari via a notebook using the following code:

from PIL import Image
import numpy as np
import napari

ch0 = np.array(Image.open('./test-files/ch0.tif'))

preview = napari.Viewer()
preview.add_image(ch0, colormap='blue')
napari.run()

In either of the cases, I can open napari as it should and I can see my image correctly.

When I look at the plugin tab though, I cannot only see the napari-time-slicer and the napari_skimage_regionprops2 plugins, while napari-pyclesperanto-assistant is present in conda list.

I tried uninstalling napari-pyclesperanto-assistant, restarting napari, installing napari-pyclesperanto-assistant, and restarting napari, but I can't get the plugin to appear.

Am I missing something obvious, or is there something else going on?

Kind regards, Dirk

haesleinhuepf commented 2 years ago

Hi @DirkRemmers,

could you please check in the menu Plugins > Plugin Errors ... if the assistant is listed in the little pulldown and had an error while loading?

Furthermore, could you please copy the content of the dialog in menu Help > Napari info ?

Thanks for reporting the issue btw! Robert

DirkRemmers commented 2 years ago

Hi Robert,

Thank you for the quick response. Indeed it seems like there is an error while loading the assistant. This is the entire error message

========================= Errors for plugin 'clEsperanto' =========================

napari version: 0.4.13

ERROR #1: Error while importing module napari_pyclesperanto_assistant._napari_plugin 

---------------------------------------------------------------------------
LogicError                                Traceback (most recent call last)
~/.local/lib/python3.8/site-packages/napari_plugin_engine/manager.py in _load_and_register(self=, mod_name='napari_pyclesperanto_assistant._napari_plugin', plugin_name='clEsperanto')
    317         try:
--> 318             module = load(mod_name)
        module = undefined
        global load = 
        mod_name = 'napari_pyclesperanto_assistant._napari_plugin'
    319             if self.is_registered(module):

~/.local/lib/python3.8/site-packages/napari_plugin_engine/manager.py in load(value='napari_pyclesperanto_assistant._napari_plugin')
   1041         raise ValueError(f"malformed entry point string: {value}")
-> 1042     module = importlib.import_module(match.group('module'))
        module = undefined
        global importlib.import_module = 
        match.group = 
   1043     attrs = filter(None, (match.group('attr') or '').split('.'))

~/miniconda3/envs/try-out/lib/python3.8/importlib/__init__.py in import_module(name='napari_pyclesperanto_assistant._napari_plugin', package=None)
    126             level += 1
--> 127     return _bootstrap._gcd_import(name[level:], package, level)
        global _bootstrap._gcd_import = 
        name = 'napari_pyclesperanto_assistant._napari_plugin'
        level = 0
        package = None
    128 

~/miniconda3/envs/try-out/lib/python3.8/importlib/_bootstrap.py in _gcd_import(name='napari_pyclesperanto_assistant._napari_plugin', package=None, level=0)

~/miniconda3/envs/try-out/lib/python3.8/importlib/_bootstrap.py in _find_and_load(name='napari_pyclesperanto_assistant._napari_plugin', import_=)

~/miniconda3/envs/try-out/lib/python3.8/importlib/_bootstrap.py in _find_and_load_unlocked(name='napari_pyclesperanto_assistant._napari_plugin', import_=)

~/miniconda3/envs/try-out/lib/python3.8/importlib/_bootstrap.py in _call_with_frames_removed(f=, *args=('napari_pyclesperanto_assistant',), **kwds={})

~/miniconda3/envs/try-out/lib/python3.8/importlib/_bootstrap.py in _gcd_import(name='napari_pyclesperanto_assistant', package=None, level=0)

~/miniconda3/envs/try-out/lib/python3.8/importlib/_bootstrap.py in _find_and_load(name='napari_pyclesperanto_assistant', import_=)

~/miniconda3/envs/try-out/lib/python3.8/importlib/_bootstrap.py in _find_and_load_unlocked(name='napari_pyclesperanto_assistant', import_=)

~/miniconda3/envs/try-out/lib/python3.8/importlib/_bootstrap.py in _load_unlocked(spec=ModuleSpec(name='napari_pyclesperanto_assistant'...8/site-packages/napari_pyclesperanto_assistant']))

~/miniconda3/envs/try-out/lib/python3.8/importlib/_bootstrap_external.py in exec_module(self=, module=)

~/miniconda3/envs/try-out/lib/python3.8/importlib/_bootstrap.py in _call_with_frames_removed(f=, *args=( at 0x7fc9c408cf50, file "/...ari_pyclesperanto_assistant/__init__.py", line 1>, {'__builtins__': {'ArithmeticError': , 'AssertionError': , 'AttributeError': , 'BaseException': , 'BlockingIOError': , 'BrokenPipeError': , 'BufferError': , 'BytesWarning': , 'ChildProcessError': , 'ConnectionAbortedError': , ...}, '__cached__': '/home/dirk/miniconda3/envs/try-out/lib/python3.8...nto_assistant/__pycache__/__init__.cpython-38.pyc', '__doc__': None, '__file__': '/home/dirk/miniconda3/envs/try-out/lib/python3.8...ckages/napari_pyclesperanto_assistant/__init__.py', '__loader__': , '__name__': 'napari_pyclesperanto_assistant', '__package__': 'napari_pyclesperanto_assistant', '__path__': ['/home/dirk/miniconda3/envs/try-out/lib/python3.8/site-packages/napari_pyclesperanto_assistant'], '__spec__': ModuleSpec(name='napari_pyclesperanto_assistant'...8/site-packages/napari_pyclesperanto_assistant'])}), **kwds={})

~/miniconda3/envs/try-out/lib/python3.8/site-packages/napari_pyclesperanto_assistant/__init__.py in 
----> 1 from ._gui import Assistant
        global _gui = undefined
        global Assistant = undefined
      2 from ._convert_to_numpy import *
      3 

~/miniconda3/envs/try-out/lib/python3.8/site-packages/napari_pyclesperanto_assistant/_gui/__init__.py in 
----> 1 from ._Assistant import Assistant
        global _Assistant = undefined
        global Assistant = undefined

~/miniconda3/envs/try-out/lib/python3.8/site-packages/napari_pyclesperanto_assistant/_gui/_Assistant.py in 
      8 
----> 9 import pyclesperanto_prototype as cle
        global pyclesperanto_prototype = undefined
        global cle = undefined
     10 from qtpy.QtWidgets import QFileDialog, QLineEdit, QVBoxLayout, QWidget, QMenu

~/miniconda3/envs/try-out/lib/python3.8/site-packages/pyclesperanto_prototype/__init__.py in 
----> 1 from ._tier0 import *
        global _tier0 = undefined
      2 from ._tier1 import *
      3 from ._tier2 import *

~/miniconda3/envs/try-out/lib/python3.8/site-packages/pyclesperanto_prototype/_tier0/__init__.py in 
     35 from ._push import push as asarray
---> 36 from ._plugin_function import plugin_function
        global _plugin_function = undefined
        global plugin_function = undefined
     37 from ._types import Image

~/miniconda3/envs/try-out/lib/python3.8/site-packages/pyclesperanto_prototype/_tier0/_plugin_function.py in 
      7 from ._create import create_like
----> 8 from ._types import Image, is_image
        global _types = undefined
        global Image = undefined
        global is_image = undefined
      9 from ._push import push

~/miniconda3/envs/try-out/lib/python3.8/site-packages/pyclesperanto_prototype/_tier0/_types.py in 
      1 import numpy as np
----> 2 from ._pycl import OCLArray, _OCLImage
        global _pycl = undefined
        global OCLArray = undefined
        global _OCLImage = undefined
      3 import pyopencl as cl

~/miniconda3/envs/try-out/lib/python3.8/site-packages/pyclesperanto_prototype/_tier0/_pycl.py in 
     26 
---> 27 if characterize.has_double_support(get_device().device):
        global characterize.has_double_support = 
        global get_device.device = undefined
     28     cl_buffer_datatype_dict[np.float64] = "double"

~/miniconda3/envs/try-out/lib/python3.8/site-packages/pyclesperanto_prototype/_tier0/_device.py in get_device()
     42     """Get the current device GPU class."""
---> 43     return _current_device._instance or select_device()
        global _current_device._instance = None
        global select_device = 
     44 

~/miniconda3/envs/try-out/lib/python3.8/site-packages/pyclesperanto_prototype/_tier0/_device.py in select_device(name=None, dev_type=None, score_key=None)
     71 
---> 72     device = filter_devices(name, dev_type, score_key)[-1]
        device = undefined
        global filter_devices = 
        name = None
        dev_type = None
        score_key = None
     73     if _current_device._instance and device == _current_device._instance.device:

~/miniconda3/envs/try-out/lib/python3.8/site-packages/pyclesperanto_prototype/_tier0/_device.py in filter_devices(name=None, dev_type=None, score_key=None)
    100     devices = []
--> 101     for platform in cl.get_platforms():
        platform = undefined
        global cl.get_platforms = 
    102         for device in platform.get_devices():

LogicError: clGetPlatformIDs failed: PLATFORM_NOT_FOUND_KHR

The above exception was the direct cause of the following exception:

PluginImportError                         Traceback (most recent call last)
~/.local/lib/python3.8/site-packages/napari_plugin_engine/manager.py in discover(self=, path=None, entry_point=None, prefix=None, ignore_errors=True)
    262 
    263             try:
--> 264                 if self._load_and_register(mod_name, name):
        self._load_and_register = >
        mod_name = 'napari_pyclesperanto_assistant._napari_plugin'
        name = 'clEsperanto'
    265                     count += 1
    266                     self._id_counts[name] = 1

~/.local/lib/python3.8/site-packages/napari_plugin_engine/manager.py in _load_and_register(self=, mod_name='napari_pyclesperanto_assistant._napari_plugin', plugin_name='clEsperanto')
    320                 return None
    321         except Exception as exc:
--> 322             raise PluginImportError(
        global PluginImportError = 
        plugin_name = 'clEsperanto'
        global cause = undefined
        exc = undefined
    323                 f'Error while importing module {mod_name}',
    324                 plugin_name=plugin_name,

PluginImportError: Error while importing module napari_pyclesperanto_assistant._napari_plugin
================================================================================

The contents of Help > Napari info is the following:

napari: 0.4.13
Platform: Linux-5.13.0-27-generic-x86_64-with-glibc2.10
System: Ubuntu 20.04.3 LTS
Python: 3.8.5 | packaged by conda-forge | (default, Sep 24 2020, 16:55:52) [GCC 7.5.0]
Qt: 5.15.2
PyQt5: 5.15.6
NumPy: 1.21.2
SciPy: 1.7.1
Dask: 2022.01.0
VisPy: 0.9.4

OpenGL:
- GL version: 4.6 (Compatibility Profile) Mesa 21.0.3
- MAX_TEXTURE_SIZE: 16384

Screens:
- screen 1: resolution 1920x1080, scale 1.0
- screen 2: resolution 1920x1080, scale 1.0

Plugins:
- console: 0.0.4
- napari-time-slicer: 0.4.2
- napari-tools-menu: 0.1.10
- napari_skimage_regionprops1: 0.2.9
- napari_skimage_regionprops2: 0.2.9
- scikit-image: 0.4.13
- svg: 0.1.6

It seems to be an issue that I currently do not have a GPU on my machine (but will have in the near future, that is why I'm exploring this). Instead of installing ocl-icd-system, I figured I had to use conda install pocl, and now indeed it works! Thank you very much for the tip to check the Plugin errors, and also thank you for the quick reply!

I will close the issue now since it is solved, hopefully it will help some people in the future as well!

Cheers, Dirk

haesleinhuepf commented 2 years ago

Thanks for letting me know @DirkRemmers ! And just to add: PLATFORM_NOT_FOUND_KHR is a typical error on computers, where no recent GPU driver is installed.

Have a great weekend!

Cheers, Robert