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
importosos.environ['DISPLAY'] =':1.0'## get from `env |grep DISPLAY`%guiqt5fromskimageimportdataimportnapariviewer=napari.view_image(data.astronaut(), rgb=True)
Exception
---------------------------------------------------------------------------ImportErrorTraceback (mostrecentcalllast)
/tmp/ipykernel_722701/837316459.pyin<module>2importnapari3---->4viewer=napari.view_image(data.astronaut(), rgb=True)
~/lib/python/miniconda3/envs/hvDataLab/lib/python3.7/site-packages/napari/_lazy.pyin__getattr__(name)
45returnimport_module(f'{module_name}.{name}')
46elifnameinattr_to_modules:
--->47submod=import_module(f'{module_name}.{attr_to_modules[name]}')
48returngetattr(submod, name)
49else:
~/lib/python/miniconda3/envs/hvDataLab/lib/python3.7/importlib/__init__.pyinimport_module(name, package)
125break126level+=1-->127return_bootstrap._gcd_import(name[level:], package, level)
128129~/lib/python/miniconda3/envs/hvDataLab/lib/python3.7/importlib/_bootstrap.pyin_gcd_import(name, package, level)
~/lib/python/miniconda3/envs/hvDataLab/lib/python3.7/importlib/_bootstrap.pyin_find_and_load(name, import_)
~/lib/python/miniconda3/envs/hvDataLab/lib/python3.7/importlib/_bootstrap.pyin_find_and_load_unlocked(name, import_)
~/lib/python/miniconda3/envs/hvDataLab/lib/python3.7/importlib/_bootstrap.pyin_load_unlocked(spec)
~/lib/python/miniconda3/envs/hvDataLab/lib/python3.7/importlib/_bootstrap_external.pyinexec_module(self, module)
~/lib/python/miniconda3/envs/hvDataLab/lib/python3.7/importlib/_bootstrap.pyin_call_with_frames_removed(f, *args, **kwds)
~/lib/python/miniconda3/envs/hvDataLab/lib/python3.7/site-packages/napari/view_layers.pyin<module>19fromnapari.components.dimsimportDims20--->21from .viewerimportViewer2223__all__= [
~/lib/python/miniconda3/envs/hvDataLab/lib/python3.7/site-packages/napari/viewer.pyin<module>5importmagicguiasmgui6---->7from .components.viewer_modelimportViewerModel8from .utilsimport_magicgui, config9~/lib/python/miniconda3/envs/hvDataLab/lib/python3.7/site-packages/napari/components/__init__.pyin<module>17from .cameraimportCamera18from .dimsimportDims--->19from .layerlistimportLayerList2021# Note that importing _viewer_key_bindings is needed as the Viewer gets~/lib/python/miniconda3/envs/hvDataLab/lib/python3.7/site-packages/napari/components/layerlist.pyin<module>6importnumpyasnp7---->8from ..layersimportLayer9from ..layers.image.imageimport_ImageBase10from ..utils.contextimportcreate_context~/lib/python/miniconda3/envs/hvDataLab/lib/python3.7/site-packages/napari/layers/__init__.pyin<module>10from ..utils.miscimportall_subclassesas_all_subcls11from .baseimportLayer--->12from .imageimportImage13from .labelsimportLabels14from .pointsimportPoints~/lib/python/miniconda3/envs/hvDataLab/lib/python3.7/site-packages/napari/layers/image/__init__.pyin<module>---->1from . import_image_key_bindings2from .imageimportImage34# Note that importing _image_key_bindings is needed as the Image layer gets5# decorated with keybindings during that process, but it is not directly needed~/lib/python/miniconda3/envs/hvDataLab/lib/python3.7/site-packages/napari/layers/image/_image_key_bindings.pyin<module>4from ...utils.translationsimporttrans5from ._image_constantsimportMode---->6from .imageimportImage78~/lib/python/miniconda3/envs/hvDataLab/lib/python3.7/site-packages/napari/layers/image/image.pyin<module>10fromscipyimportndimageasndi11--->12from ...utilsimportconfig13from ...utils._dtypeimportget_dtype_limits, normalize_dtype14from ...utils.colormapsimportAVAILABLE_COLORMAPS~/lib/python/miniconda3/envs/hvDataLab/lib/python3.7/site-packages/napari/utils/config.pyin<module>3importos4---->5from ._octreeimportget_octree_config67~/lib/python/miniconda3/envs/hvDataLab/lib/python3.7/site-packages/napari/utils/_octree.pyin<module>9fromtypingimportOptional10--->11from ..settingsimportget_settings12from ..utils.translationsimporttrans13~/lib/python/miniconda3/envs/hvDataLab/lib/python3.7/site-packages/napari/settings/__init__.pyin<module>4from ..utils.translationsimporttrans5from ._baseimport_NOT_SET---->6from ._napari_settingsimportNapariSettings78__all__= ['NapariSettings', 'get_settings']
~/lib/python/miniconda3/envs/hvDataLab/lib/python3.7/site-packages/napari/settings/_napari_settings.pyin<module>7from ..utils._baseimport_DEFAULT_CONFIG_PATH8from ..utils.translationsimporttrans---->9from ._appearanceimportAppearanceSettings10from ._applicationimportApplicationSettings11from ._baseimportEventedConfigFileSettings~/lib/python/miniconda3/envs/hvDataLab/lib/python3.7/site-packages/napari/settings/_appearance.pyin<module>23from ..utils.events.evented_modelimportEventedModel---->4from ..utils.themeimportavailable_themes5from ..utils.translationsimporttrans6from ._fieldsimportTheme~/lib/python/miniconda3/envs/hvDataLab/lib/python3.7/site-packages/napari/utils/theme.pyin<module>333334-->335_install_npe2_themes(_themes)
336_themes.events.added.connect(rebuild_theme_settings)
337_themes.events.removed.connect(rebuild_theme_settings)
~/lib/python/miniconda3/envs/hvDataLab/lib/python3.7/site-packages/napari/utils/theme.pyin_install_npe2_themes(_themes)
323# this function here instead of plugins._npe2 to avoid circular import324def_install_npe2_themes(_themes):
-->325importnpe2326327forthemeinnpe2.PluginManager.instance().iter_themes():
~/lib/python/miniconda3/envs/hvDataLab/lib/python3.7/site-packages/npe2/__init__.pyin<module>6__email__="[email protected]"7---->8from ._dynamic_pluginimportDynamicPlugin9from ._plugin_managerimportPluginContext, PluginManager10from .io_utilsimportread, read_get_reader, write, write_get_writer~/lib/python/miniconda3/envs/hvDataLab/lib/python3.7/site-packages/npe2/_dynamic_plugin.pyin<module>17fromtyping_extensionsimportLiteral18--->19from ._plugin_managerimportPluginManager20from .manifest.contributionsimport (
21CommandContribution,
~/lib/python/miniconda3/envs/hvDataLab/lib/python3.7/site-packages/npe2/_plugin_manager.pyin<module>5fromcollectionsimportCounter6fromfnmatchimportfnmatch---->7fromimportlibimportmetadata8frompathlibimportPath9fromtypingimport (
ImportError: cannotimportname'metadata'from'importlib' (/home/eldada/lib/python/miniconda3/envs/hvDataLab/lib/python3.7/importlib/__init__.py)
Additional versions info that may be of relevance
Python implementation: CPython
Python version : 3.7.12
IPython version : 7.33.0
jupyterlab : 3.4.6
napari: 0.4.14
Linux 5.19.0-76051900-generic #202207312230~1660780566~22.04~9d60db1 SMP PREEMPT_DYNAMIC Thu A x86_64 x86_64 x86_64 GNU/Linux
The text was updated successfully, but these errors were encountered:
Description
Attempting to open up a
napari
interactive viewer window fails withImportError
exception, both from command-line and jupyterlab.Downgrading
npe2
from0.3.0
to0.2.2
or0.1.1
resolves for me; for example using conda:haven't tested other newer versions.
Issue may be related to
importlib.metadata
issue on import (Python 3.7 & Linux) #4747What I Did
CLI:
Exception
JLab
Exception
Additional versions info that may be of relevance
The text was updated successfully, but these errors were encountered: