【问题标题】:Unable to perform Bokeh export_png from docker image无法从 docker 图像执行 Bokeh export_png
【发布时间】:2020-09-30 02:49:15
【问题描述】:

当尝试在 Docker 容器中运行通过 nbconvert 运行 export_png 的 Jupyter 笔记本时,我收到以下错误。

 Neither firefox and geckodriver nor a variant of chromium browser and chromedriver are available on system PATH. You can install the former with 'conda install -c conda-forge firefox geckodriver'.

我有一个配置了类似依赖项的 Linux 虚拟机,并且一切正常。如果路径指向脚本,我发现在查找 firefox 时存在错误,但我的没有,如下面的最后几行输出所示。我开始认为产生的运行时错误是一个红鲱鱼,它实际上抛出了一个不同的错误,但硬编码到该消息中。

在 docker 图像中运行 bokeh export_png 是否有任何已知问题?有什么必要的配置吗?任何人都可以使用您可以分享的 firefox、geckodriver、selenium 和 bokeh 版本成功地做到这一点?安装 chromium 并不容易,因为这一切都在没有这些软件包的公司 conda 镜像后面。

/opt/conda/lib/python3.7/site-packages/bokeh/io/webdriver.py in get(self)
    116         if not self.reuse or self.current is None:
    117             self.reset()
--> 118             self.current = self.create()
    119         return self.current
    120

/opt/conda/lib/python3.7/site-packages/bokeh/io/webdriver.py in create(self, kind)
    120
    121     def create(self, kind: Optional[DriverKind] = None) -> WebDriver:
--> 122         driver = self._create(kind)
    123         self._drivers.add(driver)
    124         return driver

/opt/conda/lib/python3.7/site-packages/bokeh/io/webdriver.py in _create(self, kind)
    138                 return driver
    139
--> 140             raise RuntimeError("Neither firefox and geckodriver nor a variant of chromium browser and " \
    141                                "chromedriver are available on system PATH. You can install the former " \
    142                                "with 'conda install -c conda-forge firefox geckodriver'.")

RuntimeError: Neither firefox and geckodriver nor a variant of chromium browser and chromedriver are available on system PATH. You can install the former with 'conda install -c conda-forge firefox geckodriver'.
RuntimeError: Neither firefox and geckodriver nor a variant of chromium browser and chromedriver are available on system PATH. You can install the former with 'conda install -c conda-forge firefox geckodriver'.

[g_de_auto@0ff0d47b4a0f data_science_foundation]$ which firefox
/opt/conda/bin/FirefoxApp/firefox
[g_de_auto@0ff0d47b4a0f data_science_foundation]$ which geckodriver
/opt/conda/bin/geckodriver
[g_de_auto@0ff0d47b4a0f data_science_foundation]$ cat /opt/conda/bin/FirefoxApp/firefox
ELF>@@1@8
         @@@@@@h@@@@@@  @ @-=@=@-=@=@0@@DDPtd` ` @` @<<QtdRtd-=@=@PP/lib64/ld-linux-x86-64.so.2GNU GNUB
m5Jzq
       ms- libpthread.so.0__errno_locationlibdl.so.2__gmon_start__libstdc++.so.6libm.so.6libgcc_s.so.1libc.so.6execv__stack_chk_fail_]`@@D]fD`@@UH`@@HHHH?HHtHt @@(@@0@@8@@@@@H@H/Ht5/%/@%/h%/h%/h%/h%/h%/h%/h%R/f1I^HHPTI@Hp@H@fDU`@@H=`@@HtHt
17dH%(H;tf.DAWAAVIAUIATL%(+UH-(+SL)1H]HtLLDAHH9u[]A\A]A^A_ff./proc/self/exeCouldn't find the application directory.
-binExec failed with error: %s

更新 我从 _try_create_firefox_webdriver 函数中得到的基本错误是 SessionNotCreatedException('Unable to find a matching set of capabilities')

【问题讨论】:

  • 我想知道是否有一个标志可以传递给 docker run 以启用图形子系统或自定义 Web 驱动程序选项来解决此问题。仍然没有工作。在运行命令中尝试了 --gpus all,但尝试时出现错误。
  • 尝试决定是使用 Xvfb 作为虚拟帧缓冲区并在导出中进行一些相关的配置更改,还是使用 Kaleido。我还没有找到适用于 Bokeh 的 Kaleido 范围或任何与 Kaleido 导出的 Bokeh 相关示例。

标签: docker bokeh


【解决方案1】:

选择使用 Xvfb。调查了 Kaleido,但我没有看到与 Bokeh 的简单集成。步骤是:

安装以下依赖项。

yum install gtk3-devel xorg-x11-server-Xvfb.x86_64 selenium geckodriver=0.26.0 firefox=74.0

告诉 Firefox 使用什么显示器(虚拟显示器)。

export DISPLAY=:0

与我的命令一起启动 Xvfb。

Xvfb :0 -screen 0 1920x1080x24 & script_that_turns_charts_to_images

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-11-28
    • 2017-03-06
    • 2016-12-10
    • 2021-09-28
    • 1970-01-01
    • 2019-02-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多