qiime2 couldn't connect to display "localhost:12.0"

qiime2 couldn't connect to display "localhost:12.0"
Traceback (most recent call last):
  File "/share/work/biosoft/conda/Miniconda3.8/envs/qiime2-2020.8/lib/python3.6/site-packages/q2cli/commands.py", line 329, in __call__
    results = action(**arguments)
  File "<decorator-gen-545>", line 2, in summarize
  File "/share/work/biosoft/conda/Miniconda3.8/envs/qiime2-2020.8/lib/python3.6/site-packages/qiime2/sdk/action.py", line 245, in bound_callable
    output_types, provenance)
  File "/share/work/biosoft/conda/Miniconda3.8/envs/qiime2-2020.8/lib/python3.6/site-packages/qiime2/sdk/action.py", line 452, in _callable_executor_
    ret_val = self._callable(output_dir=temp_dir, **view_args)
  File "/share/work/biosoft/conda/Miniconda3.8/envs/qiime2-2020.8/lib/python3.6/site-packages/q2_demux/_summarize/_visualizer.py", line 177, in summarize
    ax = sns.distplot(result, kde=False, color='black')
  File "/share/work/biosoft/conda/Miniconda3.8/envs/qiime2-2020.8/lib/python3.6/site-packages/seaborn/distributions.py", line 167, in distplot
    ax = plt.gca()
  File "/share/work/biosoft/conda/Miniconda3.8/envs/qiime2-2020.8/lib/python3.6/site-packages/matplotlib/pyplot.py", line 879, in gca
    return gcf().gca(**kwargs)
  File "/share/work/biosoft/conda/Miniconda3.8/envs/qiime2-2020.8/lib/python3.6/site-packages/matplotlib/pyplot.py", line 611, in gcf
    return figure()
  File "/share/work/biosoft/conda/Miniconda3.8/envs/qiime2-2020.8/lib/python3.6/site-packages/matplotlib/pyplot.py", line 546, in figure
    **kwargs)
  File "/share/work/biosoft/conda/Miniconda3.8/envs/qiime2-2020.8/lib/python3.6/site-packages/matplotlib/backend_bases.py", line 3358, in new_figure_manager
    return cls.new_figure_manager_given_figure(num, fig)
  File "/share/work/biosoft/conda/Miniconda3.8/envs/qiime2-2020.8/lib/python3.6/site-packages/matplotlib/backends/_backend_tk.py", line 888, in new_figure_manager_given_figure
    window = tk.Tk(className="matplotlib")
  File "/share/work/biosoft/conda/Miniconda3.8/envs/qiime2-2020.8/lib/python3.6/tkinter/__init__.py", line 2023, in __init__
    self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: couldn't connect to display "localhost:12.0"
Plugin error from demux:
  couldn't connect to display "localhost:10.0"
Debug info has been saved to /tmp/qiime2-q2cli-err-cpq2ii3g.log



【出现问题的原因】 问题在于,您使用的是一个交互式后端,它试图为您创建图形窗口,但由于您断开了启动模拟时可用的x服务器,所以失败了。

【解决方法】

使用非交互式后端(请参见后端?)比如:Agg(用于Png格式,PDF, SVG或PS。在生成图形的脚本中,只需在import matplotlib.pyplot as plt之前调用matplotlib.use()即可,具体如下:

将导入更改为

import matplotlib
matplotlib.use('AGG')#或者PDF, SVG或PS
import matplotlib.pyplot as plt

永久解决办法:

mkdir -p $HOME/.config/matplotlib/ 
echo"backend: Agg" >> $HOME/.config/matplotlib/matplotlibrc




课程推荐:微生物扩增子分析课程实操     微生物16S/ITS/18S分析原理及结果解读


  • 发表于 2021-01-04 15:29
  • 阅读 ( 4312 )
  • 分类:宏基因组

你可能感兴趣的文章

相关问题

0 条评论

请先 登录 后评论
omicsgene
omicsgene

生物信息

698 篇文章

作家榜 »

  1. omicsgene 698 文章
  2. 安生水 347 文章
  3. Daitoue 167 文章
  4. 生物女学霸 120 文章
  5. xun 82 文章
  6. 红橙子 78 文章
  7. rzx 74 文章
  8. CORNERSTONE 72 文章