holoviz / holoviews

With Holoviews, your data visualizes itself.
https://holoviews.org
BSD 3-Clause "New" or "Revised" License
2.7k stars 404 forks source link

Error on import of holoviews: '_config' object has no attribute 'initialized' #6092

Closed suske-lambik closed 9 months ago

suske-lambik commented 9 months ago

ALL software version info

(this library, plus any other relevant software, e.g. bokeh, python, notebook, OS, browser, etc) pip freeze | grep 'python|bokeh|notebook|param' bokeh==2.4.3 ipython==8.18.1 ipython-genutils==0.2.0 nbparameterise==0.6 notebook==6.5.5 notebook_shim==0.2.3 param==2.0.2 python-dateutil==2.8.2 python-json-logger==2.0.7 types-python-dateutil==2.8.19.20240106

OS: Ubuntu 22.04 Browser: Firefox

Description of expected behavior and the observed behavior

Error on importing holoviews.

Complete, minimal, self-contained example code that reproduces the issue

import holoviews

Stack traceback and/or browser JavaScript console output

AttributeError Traceback (most recent call last) Cell In[2], line 1 ----> 1 import holoviews

File ~/.pyenv/versions/cw/lib/python3.9/site-packages/holoviews/init.py:115 111 warnings.filterwarnings("ignore", 112 message="elementwise comparison failed; returning scalar instead") 114 if "IPython" in sys.modules: --> 115 from .ipython import notebook_extension 116 extension = notebook_extension # noqa (name remapping) 117 else:

File ~/.pyenv/versions/cw/lib/python3.9/site-packages/holoviews/ipython/init.py:16 14 from ..element.comparison import ComparisonTestCase 15 from ..util import extension ---> 16 from ..plotting.renderer import Renderer 17 from .magics import load_magics 18 from .display_hooks import display

File ~/.pyenv/versions/cw/lib/python3.9/site-packages/holoviews/plotting/init.py:11 9 from ..element import Area, Image, QuadMesh, Polygons, Raster 10 from ..element.sankey import _layout_sankey, Sankey ---> 11 from .plot import Plot 12 from .renderer import Renderer, HTML_TAGS # noqa (API import) 13 from .util import apply_nodata, list_cmaps # noqa (API import)

File ~/.pyenv/versions/cw/lib/python3.9/site-packages/holoviews/plotting/plot.py:17 14 import numpy as np 15 import param ---> 17 from panel.config import config 18 from panel.io.document import unlocked 19 from panel.io.notebook import push

File ~/.pyenv/versions/cw/lib/python3.9/site-packages/panel/init.py:48 1 """ 2 Panel is a high level app and dashboarding framework 3 ==================================================== (...) 46 https://panel.holoviz.org/getting_started/index.html 47 """ ---> 48 from . import layout # noqa 49 from . import links # noqa 50 from . import pane # noqa

File ~/.pyenv/versions/cw/lib/python3.9/site-packages/panel/layout/init.py:31 1 """ 2 Layout 3 ====== (...) 29 https://panel.holoviz.org/getting_started/index.html 30 """ ---> 31 from .accordion import Accordion # noqa 32 from .base import ( # noqa 33 Column, ListLike, ListPanel, Panel, Row, WidgetBox, 34 ) 35 from .card import Card # noqa

File ~/.pyenv/versions/cw/lib/python3.9/site-packages/panel/layout/accordion.py:9 5 import param 7 from bokeh.models import Column as BkColumn, CustomJS ----> 9 from .base import NamedListPanel 10 from .card import Card 12 if TYPE_CHECKING:

File ~/.pyenv/versions/cw/lib/python3.9/site-packages/panel/layout/base.py:17 13 import param 15 from bokeh.models import Column as BkColumn, Row as BkRow ---> 17 from ..io.model import hold 18 from ..io.state import state 19 from ..reactive import Reactive

File ~/.pyenv/versions/cw/lib/python3.9/site-packages/panel/io/init.py:13 11 from .logging import panel_logger # noqa 12 from .model import add_to_doc, diff, remove_root # noqa ---> 13 from .notebook import ( # noqa 14 _jupyter_server_extension_paths, block_comm, ipywidget, load_notebook, 15 push, push_notebook, 16 ) 17 from .profile import profile # noqa 18 from .resources import Resources # noqa

File ~/.pyenv/versions/cw/lib/python3.9/site-packages/panel/io/notebook.py:39 37 from .embed import embed_state 38 from .model import add_to_doc, diff ---> 39 from .resources import ( 40 PANEL_DIR, Bundle, Resources, _env, bundle_resources, 41 ) 42 from .state import state 44 if TYPE_CHECKING:

File ~/.pyenv/versions/cw/lib/python3.9/site-packages/panel/io/resources.py:30 27 from jinja2.loaders import FileSystemLoader 28 from markupsafe import Markup ---> 30 from ..config import config 31 from ..util import isurl, url_path 32 from .state import state

File ~/.pyenv/versions/cw/lib/python3.9/site-packages/panel/config.py:486 483 else: 484 _params = _config.param.params() --> 486 config = _config(**{k: None if p.allow_None else getattr(_config, k) 487 for k, p in _params.items() if k != 'name'}) 490 class panel_extension(_pyviz_extension): 491 """ 492 Initializes and configures Panel. You should always run pn.extension. 493 This will (...) 514 will be using the FastListTemplate. 515 """

File ~/.pyenv/versions/cw/lib/python3.9/site-packages/panel/config.py:261, in _config.init(self, params) 260 def init(self, params): --> 261 super().init(**params) 262 self._validating = False 263 for p in self.param:

File ~/.pyenv/versions/cw/lib/python3.9/site-packages/param/parameterized.py:4142, in Parameterized.init(self, **params) 4136 global object_count 4138 # Setting a Parameter value in an init block before calling 4139 # Parameterized.init (via super() generally) already sets the 4140 # _InstancePrivate namespace over the _ClassPrivate namespace 4141 # (see Parameter.set) so we shouldn't override it here. -> 4142 if not isinstance(self._paramprivate, _InstancePrivate): 4143 self._paramprivate = _InstancePrivate( 4144 explicit_no_refs=type(self)._param__private.explicit_no_refs 4145 ) 4147 # Skip generating a custom instance name when a class in the hierarchy 4148 # has overriden the default of the name Parameter.

File ~/.pyenv/versions/cw/lib/python3.9/site-packages/panel/config.py:348, in _config.getattribute(self, attr) 341 """ 342 Ensures that configuration parameters that are defined per 343 session are stored in a per-session dictionary. This is to 344 ensure that even on first access mutable parameters do not 345 end up being modified. 346 """ 347 from .io.state import state --> 348 init = super().getattribute('initialized') 349 global_params = super().getattribute('_globals') 350 if init and not attr.startswith('__'):

AttributeError: '_config' object has no attribute 'initialized'

Screenshots or screencasts of the bug in action

suske-lambik commented 9 months ago

Fixed by downgrading params to version 1.13.0.

github-actions[bot] commented 2 weeks ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.