【问题标题】:Virtualenv: pip install matplotlib==1.3.1: Problems with libfreetype and libaggVirtualenv: pip install matplotlib==1.3.1: libfreetype 和 libagg 的问题
【发布时间】:2019-03-23 07:19:01
【问题描述】:

我想在 virtualenv 中安装特定版本的 matplotlib (1.3.1)。我创建了 virtualenv,将其激活并运行 pip install。

virtualenv env
. ./env/bin/activate
pip install matplotlib==1.3.1

导致错误“命令“python setup.py egg_info”失败,在/tmp/pip-install-UafI0m/matplotlib/中出现错误代码1”

我厌倦的解决方案:

  • 添加了 sudo 权限
  • 升级 setuptools (pip install --upgrade setuptools)
  • 升级 pip (python -m pip install --upgrade pip)
  • 为 pip 添加了 -Iv 参数(sudo pip install -Iv matplotlib==1.3.1)
  • 已安装 ez_setup (pip install ez_setup),对于 ez_setup,pip install 工作正常。

设置: Python 2.7.15rc1 Ubuntu 18.04(仿生)

编辑: 我用一堆其他软件包对其进行了测试,并且能够正确安装所有这些软件包。最终目标是安装s4d。我按照here 给出的说明进行操作。根据要求列出了 matplotlib 版本 1.3.1。但是,哪个是 1.3.1 的合适替代品?我可以直接升级到 1.4 吗?

编辑 2:完成输出

pip2 install matplotlib==1.3.1
Collecting matplotlib==1.3.1
  Using cached https://files.pythonhosted.org/packages/d4/d0/17f17792a4d50994397052220dbe3ac9850ecbde0297b7572933fa4a5c98/matplotlib-1.3.1.tar.gz
    Complete output from command python setup.py egg_info:
    ============================================================================
    Edit setup.cfg to change the build options

    BUILDING MATPLOTLIB
                matplotlib: yes [1.3.1]
                    python: yes [2.7.15rc1 (default, Apr 15 2018, 21:51:34)
                            [GCC 7.3.0]]
                  platform: yes [linux2]

    REQUIRED DEPENDENCIES AND EXTENSIONS
                     numpy: yes [version 1.9.0]
                  dateutil: yes [using dateutil version 2.2]
                   tornado: yes [tornado was not found. It is required for the
                            WebAgg backend. pip/easy_install may attempt to
                            install it after matplotlib.]
                 pyparsing: yes [using pyparsing version 2.0.2]
                     pycxx: yes [Couldn't import.  Using local copy.]
                    libagg: yes [pkg-config information for 'libagg' could not
                            be found. Using local copy.]
                  freetype: no  [pkg-config information for 'freetype2' could
                            not be found.]
                       png: yes [version 1.2.54]

    OPTIONAL SUBPACKAGES
               sample_data: yes [installing]
                  toolkits: yes [installing]
                     tests: yes [using nose version 1.3.4]

    OPTIONAL BACKEND EXTENSIONS
                    macosx: no  [Mac OS-X only]
                    qt4agg: no  [PyQt4 not found]
                   gtk3agg: no  [Requires pygobject to be installed.]
                 gtk3cairo: no  [Requires cairo to be installed.]
                    gtkagg: no  [Requires pygtk]
                     tkagg: no  [The C/C++ header for Tk (tk.h) could not be
                            found.  You may need to install the development
                            package.]
                     wxagg: no  [requires wxPython]
                       gtk: no  [Requires pygtk]
                       agg: yes [installing]
                     cairo: no  [cairo not found]
                 windowing: no  [Microsoft Windows only]

    OPTIONAL LATEX DEPENDENCIES
                    dvipng: no
               ghostscript: yes [version 9.25]
                     latex: no
                   pdftops: yes [version 0.62.0]

    ============================================================================
                            * The following required packages can not be built:
                            * freetype

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-Ji6dpj/matplotlib/

编辑 3:libfreetype2 和 libagg 所以我们将其缩小到缺少 libfreetype(和 libagg)。在最近更新到 Ubuntu 18.04 之后,我在字体渲染方面遇到了很多问题。所以我按照here的建议降级了freetype,使用以下bash命令:

sudo add-apt-repository "deb http://us.archive.ubuntu.com/ubuntu/ artful-updates main"
sudo apt-get update
sudo apt-get install libfreetype6=2.8-0.2ubuntu2.1
sudo apt-mark hold libfreetype6

我检查了是否安装了freetype(它是)

ldconfig -p | grep freetype

所以我取消了 freetype6 的标记并运行了 update、upgrade 和 dist-upgrade,然后检查了是否可以安装 matplotlib,导致同样的错误。有谁知道如何解决这个问题? 我必须在 pkg-config 中编辑一些内容吗?

sudo apt-mark unhold libfreetype6
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
source env/bin/activate
pip install matplotlib==1.3.1

编辑 4 / 初步解决方案 软件包 libfreetype6-dev (sudo apt-get install libfreetype6-dev) 提供了帮助,所以现在 setup.py / pip 找到了 libfreetype。但是我面临的新错误是。但这可能是一个新问题

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

【问题讨论】:

  • 没有提供有关该错误的其他信息吗?通常我会期望打印一大堆东西以防安装失败。
  • 如果有帮助,我可以在帖子中编辑整个输出,但没有错误消息就是这样
  • 会不会和 libfreetype6 有关?我最近将我的 Ubuntu 升级到 18.04,这导致渲染字体出现问题。因此运行 sudo apt-get install libfreetype6=2.8-0.2ubuntu2.1; sudo apt-mark hold libfreetype6 为我解决了字体渲染问题(问题描述here)
  • 嗯,那个输出确实告诉你"The following required packages can not be built: * freetype"。你需要先安装freetype。
  • 我检查过:ldconfig -p | grep freetype 并说明 freetype 已安装

标签: python matplotlib fonts pip virtualenv


【解决方案1】:

您是否尝试仅安装 matplotlib1.4 并尝试 s4d 是否有效?可能是因为新的 matplotlib 版本出来后安装指南没有更新。

【讨论】:

  • 是的,我尝试并发布了结果。它仍然失败,但原因越来越清楚。我认为问题在于库 libagg 和 freetype6。我仍然不太确定如何解决它
  • 在您共享的链接中,它在 s4d 的 Python 包中声明:使用 S4D 需要以下包。您可以自行安装它们,也可以按照使用 virtualenv 的快速指南中描述的过程进行安装。 - 熊猫 - pyAudio - scikit-learn。因此,如果您不想要 SIDEKIT,那么您可能不需要这些软件包?
猜你喜欢
  • 2022-06-30
  • 1970-01-01
  • 1970-01-01
  • 2018-05-25
  • 1970-01-01
  • 2016-11-09
  • 2014-06-19
  • 1970-01-01
  • 2014-02-23
相关资源
最近更新 更多