2021年1月5日星期二

Bokeh Standalone chart not working in docker

i have a simple program that displays a bokeh plot in new html file from output_file() from python3.7. i also have a chart.html in templates folder with the following entries and everything works fine on local machine but the issue i am facing is when i dockerize the application where i get an error when i run the program to show bokeh chart from container.

if (root.Bokeh !== undefined) {                    embed_document(root);                  } else {                    var attempts = 0;                    var timer = setInterval(function(root) {                      if (root.Bokeh !== undefined) {                        clearInterval(timer);                        embed_document(root);                      } else {                        attempts++;                        if (attempts > 100) {                          clearInterval(timer);                          console.log("Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing");                        }                      }                    }, 10, root)                  }                })(window);              });            };            if (document.readyState != "loading") fn();   

my template/chart.html has

<!DOCTYPE html>  <html>    <head>      <title>Bokeh Chart!</title>      <link href="http://cdn.pydata.org/bokeh/release/bokeh-0.12.5.min.css" rel="stylesheet">      <link href="http://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.5.min.css" rel="stylesheet">      <link rel="stylesheet" href="https://cdn.bokeh.org/bokeh/release/bokeh-0.12.5.min.css" type="text/css" />      <link rel="stylesheet" href="https://cdn.bokeh.org/bokeh/release/bokeh-widgets-0.12.5.min.css" type="text/css" />      <link rel="stylesheet" href="https://cdn.bokeh.org/bokeh/release/bokeh-tables-0.12.5.min.css" type="text/css">      </head>    <body>      <h1>bokeh chart</h1>            <script src="https://cdn.bokeh.org/bokeh/release/bokeh-2.2.3.min.js"          crossorigin="anonymous"></script>      <script src="https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.2.3.min.js"          crossorigin="anonymous"></script>      <script src="https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.2.3.min.js"          crossorigin="anonymous"></script>      <script src="http://cdn.pydata.org/bokeh/release/bokeh-0.12.5.min.js"></script>      <script src="http://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.5.min.js"></script>      <script type="text/javascript" src="https://cdn.bokeh.org/bokeh/release/bokeh-0.12.5.min.js"></script>      <script type="text/javascript" src="https://cdn.bokeh.org/bokeh/release/bokeh-api-0.12.5.min.js"></script>      <script type="text/javascript" src="https://cdn.bokeh.org/bokeh/release/bokeh-widgets-0.12.5.min.js"></script>      <script type="text/javascript" src="https://cdn.bokeh.org/bokeh/release/bokeh-tables-0.12.5.min.js"></script>            </body>  </html>  

I tried changing this to

<!DOCTYPE html>  <html lang="en">        <head>          <meta charset="utf-8">          <title></title>    <link      href="https://cdn.bokeh.org/bokeh/release/bokeh-2.2.3.min.css"      rel="stylesheet" type="text/css">      </head>      <body>          <h1>line chart with bokeh in flask</h1>                    <div class="bk-root" id="f3e00085-05ba-43da-b01b-b67bf8cc2246" data-root-id="1612"></div>          <script src="https://cdn.bokeh.org/bokeh/release/bokeh-2.2.3.min.js" crossorigin="anonymous"></script>                </body>  </html>    

still i am getting the same error "Unable to run BokehJS code because BokehJS library is missing". i tried reading every possible stack entry but most of the topics are on bokeh server. if anyone faced similar issue or know what the problem is pls let me know.

thanks, meekey

https://stackoverflow.com/questions/65588710/bokeh-standalone-chart-not-working-in-docker January 06, 2021 at 08:54AM

没有评论:

发表评论