☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Django v4 not compatible with Bokeh

Community Supportbokeh
Bryan
Bryan

@Vulum #11148 only concerns a specific, narrow, direct integration with Django for the Bokeh server. Is that actually your use case? You need to provide details, because the answer is different:

  • If you are actually asking about the specific Bokeh server integration (that uses channels instead of websockets) then that simply does not support Django 4 at this time, and it may never.

  • If you have standalone content, or want to use standard (websocket) Bokeh server embed, i.e. anything from Embedding Bokeh content — Bokeh 2.4.2 Documentation then Django is irrelevant and you have some other issue. In order to help diagnose we would need code/details.

⌁   Link to post
Vulum
Vulum

@Bryan, my issue is as shown below:

File "/home/laravel/Documents/djangoWagtailProjects/crime_alert_app/infographics/views.py", line 55, in <module>
    import holoviews as hv
  File "/home/laravel/anaconda3/envs/crime_alert_app/lib/python3.9/site-packages/holoviews/__init__.py", line 12, in <module>
    from .annotators import annotate                         # noqa (API import)
  File "/home/laravel/anaconda3/envs/crime_alert_app/lib/python3.9/site-packages/holoviews/annotators.py", line 10, in <module>
    from panel.pane import PaneBase
  File "/home/laravel/anaconda3/envs/crime_alert_app/lib/python3.9/site-packages/panel/__init__.py", line 47, in <module>
    from . import layout # noqa
  File "/home/laravel/anaconda3/envs/crime_alert_app/lib/python3.9/site-packages/panel/layout/__init__.py", line 1, in <module>
    from .accordion import Accordion # noqa
  File "/home/laravel/anaconda3/envs/crime_alert_app/lib/python3.9/site-packages/panel/layout/accordion.py", line 5, in <module>
    from .base import NamedListPanel
  File "/home/laravel/anaconda3/envs/crime_alert_app/lib/python3.9/site-packages/panel/layout/base.py", line 13, in <module>
    from ..reactive import Reactive
  File "/home/laravel/anaconda3/envs/crime_alert_app/lib/python3.9/site-packages/panel/reactive.py", line 33, in <module>
    from .viewable import Layoutable, Renderable, Viewable
  File "/home/laravel/anaconda3/envs/crime_alert_app/lib/python3.9/site-packages/panel/viewable.py", line 26, in <module>
    from .io import serve
  File "/home/laravel/anaconda3/envs/crime_alert_app/lib/python3.9/site-packages/panel/io/__init__.py", line 25, in <module>
    from . import django # noqa
  File "/home/laravel/anaconda3/envs/crime_alert_app/lib/python3.9/site-packages/panel/io/django.py", line 4, in <module>
    from bokeh.server.django.consumers import DocConsumer, AutoloadJsConsumer
  File "/home/laravel/anaconda3/envs/crime_alert_app/lib/python3.9/site-packages/bokeh/server/django/__init__.py", line 5, in <module>
    from .apps import DjangoBokehConfig
  File "/home/laravel/anaconda3/envs/crime_alert_app/lib/python3.9/site-packages/bokeh/server/django/apps.py", line 29, in <module>
    from .routing import Routing, RoutingConfiguration
  File "/home/laravel/anaconda3/envs/crime_alert_app/lib/python3.9/site-packages/bokeh/server/django/routing.py", line 27, in <module>
    from django.conf.urls import url
ImportError: cannot import name 'url' from 'django.conf.urls' (/home/laravel/anaconda3/envs/crime_alert_app/lib/python3.9/site-packages/django/conf/urls/__init__.py)
⌁   Link to post
Bryan
Bryan

@Vulum I have two comments:

  • That stack trace indicates that this is indeed about the issue #11148. There is no solution for using Django 4 with bokeh.server.django at this time. And (personal opinion) I very much doubt there will be in the future either, unless some organization decides that they want to fund new development for it.

  • The actual error originates from usage in Panel. Panel is a separate project maintained by a different team of people. It’s possible they have their own updates on their end to handle Django 4 without using bokeh.server.django, but this is not the right place to ask that. Questions about Panel should be directed at the HoloViz Discourse:

    https://discourse.holoviz.org

⌁   Link to post
Vulum
Vulum

In light of this issue, I commented out the following imports in my django view:

#import holoviews as hv
#from holoviews import opts, dim
#from holoviews.streams import Pipe, Buffer
#from holoviews.plotting.bokeh.styles import (line_properties, fill_properties, text_properties)
#from holoviews.operation.timeseries import rolling, rolling_outlier_std

#hv.extension('bokeh')
# hv.extension('matplotlib')
#import panel as pn

And my application was running again. With those commented out lines, I was optimistic that I will still be able to render bokeh graphs in the the django views, however, I go the below error:

"title":"Bokeh Application","version":"2.4.2"}}\';\n                const render_items = [{"docid":"d9454a91-45f6-4ab5-a345-0a7f6eb5eeee","root_ids":["1002"],"roots":{"1002":"b1d62f4f-9ebf-4e01-b596-13291df92936"}}];\n                root.Bokeh.embed.embed_items(docs_json, render_items);\n              \n                }\n                if (root.Bokeh !== undefined) {\n                  embed_document(root);\n                } else {\n                  let attempts = 0;\n                  const timer = setInterval(function(root) {\n                    if (root.Bokeh !== undefined) {\n                      clearInterval(timer);\n                      embed_document(root);\n                    } else {\n                      attempts++;\n                      if (attempts > 100) {\n                        clearInterval(timer);\n                        console.log("Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing");\n                      }\n                    }\n                  }, 10, root)\n                }\n              })(window);\n            });\n          };\n          if (document.readyState != "loading") fn();\n          else document.addEventListener("DOMContentLoaded", fn);\n        })();\n</script>', 'div': '\n<div class="bk-root" id="b1d62f4f-9ebf-4e01-b596-13291df92936" data-root-id="1002"></div>', 'name_of_prov': 'Chimbu (Simbu)'}}}}

Is this the same error pertaining to the original issue of this blog?

⌁   Link to post
Vulum
Vulum

I fixed the error with:

<script src="https://cdn.bokeh.org/bokeh/release/bokeh-2.4.0.min.js"
        crossorigin="anonymous"></script>
<script src="https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.4.0.min.js"
        crossorigin="anonymous"></script>
<script src="https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.4.0.min.js"
        crossorigin="anonymous"></script>
<script src="https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.4.0.min.js"
        crossorigin="anonymous"></script>
<script src="https://cdn.bokeh.org/bokeh/release/bokeh-mathjax-2.4.0.min.js"
        crossorigin="anonymous"></script>
⌁   Link to post

End of archived discussion · Replies are disabled