千家信息网

qiime2报错couldn't connect to display "localhost:12.0"怎么解决

发表于:2025-01-18 作者:千家信息网编辑
千家信息网最后更新 2025年01月18日,这篇文章主要介绍"qiime2报错couldn't connect to display "localhost:12.0"怎么解决",在日常操作中,相信很多人在qiime2报错couldn't con
千家信息网最后更新 2025年01月18日qiime2报错couldn't connect to display "localhost:12.0"怎么解决

这篇文章主要介绍"qiime2报错couldn't connect to display "localhost:12.0"怎么解决",在日常操作中,相信很多人在qiime2报错couldn't connect to display "localhost:12.0"怎么解决问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答"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 "", 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 matplotlibmatplotlib.use('AGG')#或者PDF, SVG或PSimport matplotlib.pyplot as plt

永久解决办法:

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

到此,关于"qiime2报错couldn't connect to display "localhost:12.0"怎么解决"的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注网站,小编会继续努力为大家带来更多实用的文章!

0