haesleinhuepf / napari-simpleitk-image-processing

Process images using SimpleITK in napari
BSD 3-Clause "New" or "Revised" License
19 stars 4 forks source link

import fails with OSError on headless system #15

Open thawn opened 2 years ago

thawn commented 2 years ago

importing napari_simpleitk_image_processing fails with errors about missing GL libraries (see below). I assume this means that this plugin needs a working display?

is there a workaround to make this plugin work without gl support?

Cheers,

Till

`napari_simpleitk_image_processing` import errors --------------------------------------------------------------------------- OSError Traceback (most recent call last) Input In [6], in () 5 import numpy as np 6 #import napari_segment_blobs_and_things_with_membranes as nsbatwm ----> 7 import napari_simpleitk_image_processing as nsitk File /app/env/lib/python3.9/site-packages/napari_simpleitk_image_processing/__init__.py:9, in 3 __common_alias__ = "nsitk" 8 from ._function import napari_experimental_provide_function ----> 9 from ._simpleitk_image_processing import \ 10 plugin_function, \ 11 median_filter, \ 12 gaussian_blur, \ 13 threshold_otsu, \ 14 threshold_intermodes, \ 15 threshold_kittler_illingworth, \ 16 threshold_li, \ 17 threshold_moments, \ 18 threshold_renyi_entropy, \ 19 threshold_shanbhag, \ 20 threshold_yen, \ 21 threshold_isodata, \ 22 threshold_triangle, \ 23 threshold_huang, \ 24 threshold_maximum_entropy, \ 25 signed_maurer_distance_map, \ 26 morphological_watershed, \ 27 morphological_gradient, \ 28 standard_deviation_filter, \ 29 simple_linear_iterative_clustering, \ 30 scalar_image_k_means_clustering, \ 31 connected_component_labeling, \ 32 touching_objects_labeling, \ 33 watershed_otsu_labeling, \ 34 binary_fill_holes, \ 35 invert_intensity, \ 36 bilateral_filter, \ 37 laplacian_filter, \ 38 laplacian_of_gaussian_filter, \ 39 binominal_blur_filter, \ 40 canny_edge_detection, \ 41 gradient_magnitude, \ 42 h_maxima, \ 43 h_minima, \ 44 otsu_multiple_thresholds, \ 45 regional_maxima, \ 46 regional_minima, \ 47 richardson_lucy_deconvolution, \ 48 wiener_deconvolution, \ 49 tikhonov_deconvolution, \ 50 rescale_intensity, \ 51 sobel, \ 52 black_top_hat, \ 53 white_top_hat, \ 54 adaptive_histogram_equalization, \ 55 curvature_flow_denoise, \ 56 relabel_component, \ 57 label_contour, \ 58 label_statistics, \ 59 pixel_count_map, \ 60 elongation_map, \ 61 feret_diameter_map, \ 62 roundness_map File /app/env/lib/python3.9/site-packages/napari_simpleitk_image_processing/_simpleitk_image_processing.py:7, in 5 from toolz import curry 6 import inspect ----> 7 from napari_tools_menu import register_function 8 from napari_time_slicer import time_slicer 9 from napari_skimage_regionprops._all_frames import analyze_all_frames File /app/env/lib/python3.9/site-packages/napari_tools_menu/__init__.py:9, in 7 import warnings 8 import napari ----> 9 import napari._qt 10 import numpy as np 11 from qtpy.QtWidgets import QMenu File /app/env/lib/python3.9/site-packages/napari/_qt/__init__.py:53, in 45 warn_message = trans._( 46 "\n\nnapari was tested with QT library `>=5.12.3`.\nThe version installed is {version}. Please report any issues with\nthis specific QT version at https://github.com/Napari/napari/issues. style="color:rgb(175,0,0)">", 47 deferred=True, 48 version=QtCore.__version__, 49 ) 50 warn(message=warn_message) ---> 53 from .qt_event_loop import get_app, gui_qt, quit_app, run 54 from .qt_main_window import Window File /app/env/lib/python3.9/site-packages/napari/_qt/qt_event_loop.py:15, in 12 from qtpy.QtWidgets import QApplication 14 from .. import __version__ ---> 15 from ..settings import get_settings 16 from ..utils import config, perf 17 from ..utils.notifications import ( 18 notification_manager, 19 show_console_notification, 20 ) File /app/env/lib/python3.9/site-packages/napari/settings/__init__.py:6, in 4 from ..utils.translations import trans 5 from ._base import _NOT_SET ----> 6 from ._napari_settings import NapariSettings 8 __all__ = ['NapariSettings', 'get_settings'] 11 class _SettingsProxy: File /app/env/lib/python3.9/site-packages/napari/settings/_napari_settings.py:9, in 7 from ..utils._base import _DEFAULT_CONFIG_PATH 8 from ..utils.translations import trans ----> 9 from ._appearance import AppearanceSettings 10 from ._application import ApplicationSettings 11 from ._base import EventedConfigFileSettings, _remove_empty_dicts File /app/env/lib/python3.9/site-packages/napari/settings/_appearance.py:4, in 1 from pydantic import Field 3 from ..utils.events.evented_model import EventedModel ----> 4 from ..utils.theme import available_themes 5 from ..utils.translations import trans 6 from ._fields import Theme File /app/env/lib/python3.9/site-packages/napari/utils/__init__.py:2, in 1 from ._dask_utils import resize_dask_cache ----> 2 from .colormaps import Colormap 3 from .info import citation_text, sys_info 4 from .notebook_display import nbscreenshot File /app/env/lib/python3.9/site-packages/napari/utils/colormaps/__init__.py:2, in 1 from .colorbars import make_colorbar ----> 2 from .colormap import Colormap 3 from .colormap_utils import ( 4 ALL_COLORMAPS, 5 AVAILABLE_COLORMAPS, (...) 16 matplotlib_colormaps, 17 ) File /app/env/lib/python3.9/site-packages/napari/utils/colormaps/colormap.py:11, in 9 from ..translations import trans 10 from .colorbars import make_colorbar ---> 11 from .standardize_color import transform_color 14 class ColormapInterpolationMode(str, Enum): 15 """INTERPOLATION: Interpolation mode for colormaps. 16 17 Selects an interpolation mode for the colormap. (...) 21 bin between by neighboring controls points. 22 """ File /app/env/lib/python3.9/site-packages/napari/utils/colormaps/standardize_color.py:27, in 24 from typing import Any, Callable, Dict, Sequence 26 import numpy as np ---> 27 from vispy.color import ColorArray, get_color_dict, get_color_names 28 from vispy.color.color_array import _string_to_rgb 30 from ..translations import trans File /app/env/lib/python3.9/site-packages/vispy/color/__init__.py:12, in 10 from ._color_dict import get_color_names, get_color_dict # noqa 11 from .color_array import Color, ColorArray ---> 12 from .colormap import (Colormap, BaseColormap, # noqa 13 get_colormap, get_colormaps) # noqa 15 __all__ = ['Color', 'ColorArray', 'Colormap', 'BaseColormap', 16 'get_colormap', 'get_colormaps', 17 'get_color_names', 'get_color_dict'] File /app/env/lib/python3.9/site-packages/vispy/color/colormap.py:14, in 12 from hsluv import hsluv_to_rgb 13 from ..util.check_environment import has_matplotlib ---> 14 import vispy.gloo 16 ############################################################################### 17 # Color maps 18 19 # Length of the texture map used for luminance to RGBA conversion 20 LUT_len = 1024 File /app/env/lib/python3.9/site-packages/vispy/gloo/__init__.py:47, in 5 """ 6 Object oriented interface to OpenGL. 7 (...) 42 43 """ 45 from __future__ import division ---> 47 from . import gl # noqa 48 from .wrappers import * # noqa 49 from .context import (GLContext, get_default_config, # noqa 50 get_current_canvas) # noqa File /app/env/lib/python3.9/site-packages/vispy/gloo/gl/__init__.py:230, in 228 from . import gl2 as default_backend # noqa 229 if default_backend._lib is None: # Probably Android or RPi --> 230 from . import es2 as default_backend # noqa 233 # Call use to start using our default backend 234 use_gl() File /app/env/lib/python3.9/site-packages/vispy/gloo/gl/es2.py:48, in 46 # Else, we failed and exit 47 if es2_file is None: ---> 48 raise OSError('GL ES 2.0 library not found') 49 # Load it 50 _lib = ctypes.CDLL(es2_file) OSError: GL ES 2.0 library not found
haesleinhuepf commented 2 years ago

HI @thawn ,

this bug should be fixed in the recent release of nsitk. Can you check? If not, please let me know how I can reproduce the issue.

Thanks! Best, Robert