由于tex错误,未能并行注释文本“ RuntimeError:由于找不到dvipng,无法使用tex处理字符串”

时间:2020-07-01 09:35:13

标签: python-3.x matplotlib mpi tex dvi

我有这个脚本可以并行绘制许多图形。当我在ipython中运行它以对其进行测试时,它运行良好,但是当我提交要并行运行的作业脚本时,尝试注释某些文本时会失败。失败的部分如下:

time_string = "$t$="+str(int(time_val))+"yr"
time_string_raw = r'{}'.format(time_string)
time_text = ax.text((xlim[0]+0.01*(xlim[1]-xlim[0])), (ylim[1]-0.03*(ylim[1]-ylim[0])), time_string_raw, va="center", ha="left", color='w', fontsize=args.text_font)
plt.savefig("Test_802.jpg", format='jpg', bbox_inches='tight')

错误消息是:

 File "movie_script.py", line 804, in <module>
    plt.savefig("Test_802.jpg", format='jpg', bbox_inches='tight')
  File "home/.local/lib/python3.7/site-packages/matplotlib/pyplot.py", line 723, in savefig
    res = fig.savefig(*args, **kwargs)
  File "home/.local/lib/python3.7/site-packages/matplotlib/figure.py", line 2203, in savefig
    self.canvas.print_figure(fname, **kwargs)
  File "home/.local/lib/python3.7/site-packages/matplotlib/backend_bases.py", line 2126, in print_figure
    **kwargs)
  File "home/.local/lib/python3.7/site-packages/matplotlib/cbook/deprecation.py", line 358, in wrapper
    return func(*args, **kwargs)
  File "home/.local/lib/python3.7/site-packages/matplotlib/backends/backend_agg.py", line 584, in print_jpg
    FigureCanvasAgg.draw(self)
  File "home/.local/lib/python3.7/site-packages/matplotlib/backends/backend_agg.py", line 393, in draw
    self.figure.draw(self.renderer)
  File "home/.local/lib/python3.7/site-packages/matplotlib/artist.py", line 38, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "home/.local/lib/python3.7/site-packages/matplotlib/figure.py", line 1736, in draw
    renderer, self, artists, self.suppressComposite)
  File "home/.local/lib/python3.7/site-packages/matplotlib/image.py", line 137, in _draw_list_compositing_images
    a.draw(renderer)
  File "home/.local/lib/python3.7/site-packages/matplotlib/artist.py", line 38, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "home/.local/lib/python3.7/site-packages/matplotlib/axes/_base.py", line 2630, in draw
    mimage._draw_list_compositing_images(renderer, self, artists)
  File "home/.local/lib/python3.7/site-packages/matplotlib/image.py", line 137, in _draw_list_compositing_images
    a.draw(renderer)
  File "home/.local/lib/python3.7/site-packages/matplotlib/artist.py", line 38, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "home/.local/lib/python3.7/site-packages/matplotlib/axis.py", line 1232, in draw
    tick.draw(renderer)
  File "home/.local/lib/python3.7/site-packages/matplotlib/artist.py", line 38, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "home/.local/lib/python3.7/site-packages/matplotlib/axis.py", line 297, in draw
    artist.draw(renderer)
  File "home/.local/lib/python3.7/site-packages/matplotlib/artist.py", line 38, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "home/.local/lib/python3.7/site-packages/matplotlib/text.py", line 729, in draw
    mtext=mtext)
  File "home/.local/lib/python3.7/site-packages/matplotlib/backends/backend_agg.py", line 229, in draw_tex
    Z = texmanager.get_grey(s, size, self.dpi)
  File "home/.local/lib/python3.7/site-packages/matplotlib/texmanager.py", line 413, in get_grey
    pngfile = self.make_png(tex, fontsize, dpi)
  File "home/.local/lib/python3.7/site-packages/matplotlib/texmanager.py", line 404, in make_png
    self._run_checked_subprocess(cmd, tex)
  File "home/.local/lib/python3.7/site-packages/matplotlib/texmanager.py", line 310, in _run_checked_subprocess
    'found'.format(command[0])) from exc
P082 yt : [ERROR    ] 2020-07-01 11:02:55,300 RuntimeError: Failed to process string with tex because dvipng could not be found

0 个答案:

没有答案
相关问题