运行matplotlib时,libpng版本不兼容

时间:2018-02-18 21:30:55

标签: python matplotlib libpng

我试图使用facebook研究的Detectron。当我运行它时,它给了我以下错误:

libpng warning: Application built with libpng-1.6.21 but running with 1.5.12
Traceback (most recent call last):
  File "tools/infer_simple.py", line 147, in <module>
    main(args)
  File "tools/infer_simple.py", line 139, in main
    kp_thresh=2
  File "/home/sid/DETECTRON/detectron/lib/utils/vis.py", line 391, in vis_one_image
    fig.savefig(os.path.join(output_dir, '{}'.format(output_name)), dpi=dpi)
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/figure.py", line 1834, in savefig
    self.canvas.print_figure(fname, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/backend_bases.py", line 2267, in print_figure
    **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_pdf.py", line 2595, in print_pdf
    file.finalize()
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_pdf.py", line 595, in finalize
    self.writeImages()
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_pdf.py", line 1430, in writeImages
    ob.id, smaskObject)
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_pdf.py", line 1416, in _writeImg
    self._writePng(data)
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_pdf.py", line 1366, in _writePng
    _png.write_png(data, buffer)
RuntimeError: Could not create write struct

我正在运行Ubuntu 16.04。我不知道应用程序在哪里找到libpng 1.5.12版本。我在我的系统中找不到它。我安装了libpng16-16。它仍然给我同样的错误。我尝试了平台上建议的其他解决方案,但他们没有工作

1 个答案:

答案 0 :(得分:1)

我想问题是您sudo pip安装了matplotlib,并且matplotlib的manylinux安装包附带的libpng版本与{{1}安装的libpng版本混淆}。我建议在virtual environment内使用matplotlib。

apt