haesleinhuepf / BioImageAnalysisNotebooks

Python Jupyter notebooks for BioImageAnalysis, GPU-accelerated image processing, bio-image data science and more
https://haesleinhuepf.github.io/BioImageAnalysisNotebooks
BSD 3-Clause "New" or "Revised" License
115 stars 32 forks source link

Logic error when trying to open image with pyscleranto_prototype #24

Closed sebgoti closed 1 year ago

sebgoti commented 1 year ago

Getting the following error when trying to open a single channel tiff image with cle.imshow():

Command:

cle.imshow(single_channel_image, color_map='Greys_r')`

Output:

---------------------------------------------------------------------------
LogicError                                Traceback (most recent call last)
Cell In[6], line 3
      1 single_channel_image = multichannel_image[:, :, 0]
----> 3 cle.imshow(single_channel_image, color_map='Greys_r')

File ~/mambaforge/envs/devbio-napari-env/lib/python3.9/site-packages/pyclesperanto_prototype/_tier0/_plugin_function.py:65, in plugin_function.<locals>.worker_function(*args, **kwargs)
     63 for key, value in bound.arguments.items():
     64     if is_image(value) and key in sig.parameters and sig.parameters[key].annotation is Image:
---> 65         bound.arguments[key] = push(value)
     66     if key in sig.parameters and sig.parameters[key].annotation is Image and value is None:
     67         sig2 = inspect.signature(output_creator)

File ~/mambaforge/envs/devbio-napari-env/lib/python3.9/site-packages/pyclesperanto_prototype/_tier0/_push.py:41, in push(any_array)
     38 if hasattr(any_array, 'shape') and hasattr(any_array, 'dtype') and hasattr(any_array, 'get'):
     39     any_array = np.asarray(any_array.get())
---> 41 return Backend.get_instance().get().from_array(np.float32(any_array))

File ~/mambaforge/envs/devbio-napari-env/lib/python3.9/site-packages/pyclesperanto_prototype/_tier0/_opencl_backend.py:44, in OpenCLBackend.from_array(self, *args, **kwargs)
     43 def from_array(self, *args, **kwargs):
---> 44     return OCLArray.from_array(*args, **kwargs)

File ~/mambaforge/envs/devbio-napari-env/lib/python3.9/site-packages/pyclesperanto_prototype/_tier0/_pycl.py:69, in OCLArray.from_array(cls, arr, *args, **kwargs)
     66 @classmethod
     67 def from_array(cls, arr, *args, **kwargs):
     68     assert_supported_ndarray_type(arr.dtype.type)
---> 69     queue = get_device().queue
     70     return OCLArray.to_device(queue, prepare(arr), *args, **kwargs)

File ~/mambaforge/envs/devbio-napari-env/lib/python3.9/site-packages/pyclesperanto_prototype/_tier0/_device.py:43, in get_device()
     41 def get_device() -> Device:
     42     """Get the current device GPU class."""
---> 43     return _current_device._instance or select_device()

File ~/mambaforge/envs/devbio-napari-env/lib/python3.9/site-packages/pyclesperanto_prototype/_tier0/_device.py:72, in select_device(name, dev_type, score_key)
     68 except:
     69     pass
---> 72 device = filter_devices(name, dev_type, score_key)[-1]
     73 if _current_device._instance and device == _current_device._instance.device:
     74     return _current_device._instance

File ~/mambaforge/envs/devbio-napari-env/lib/python3.9/site-packages/pyclesperanto_prototype/_tier0/_device.py:101, in filter_devices(name, dev_type, score_key)
     89 """Filter devices based on various options
     90 
     91 :param name: First device that contains ``name`` will be returned, defaults to None
   (...)
     98 :rtype: List[cl.Device]
     99 """
    100 devices = []
--> 101 for platform in cl.get_platforms():
    102     for device in platform.get_devices():
    103         if name and name.lower() in device.name.lower():

LogicError: clGetPlatformIDs failed: PLATFORM_NOT_FOUND_KHR
haesleinhuepf commented 1 year ago

Hi @sebgoti ,

can you check if the graphics card is properly installed? You find some hints here: https://github.com/clEsperanto/pyclesperanto_prototype#troubleshooting-graphics-cards-drivers

Let me know if this helps! If not, it would be good to learn some details about the computer you are running the notebook on.

Thanks!

Best, Robert

haesleinhuepf commented 1 year ago

I presume this issue was solved. If not, please open another issue.