简体   繁体   English

Virtualenv:pip install matplotlib == 1.3.1:libfreetype和libagg存在问题

[英]Virtualenv: pip install matplotlib==1.3.1: Problems with libfreetype and libagg

I want to install a specific version of matplotlib (1.3.1) in a virtualenv. 我想在virtualenv中安装特定版本的matplotlib(1.3.1)。 I created the virtualenv, activated it and ran pip install. 我创建了virtualenv,将其激活并运行pip安装。

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

Resulting in error "Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-UafI0m/matplotlib/" 导致错误“ / tmp / pip-install-UafI0m / matplotlib /中的错误代码为1的命令“ python setup.py egg_info”失败”

Solutions I tired: 解决方案我很累:

  • Added sudo permission 添加了sudo权限
  • Upgrade setuptools (pip install --upgrade setuptools) 升级setuptools(pip install --upgrade setuptools)
  • Upgrade pip (python -m pip install --upgrade pip) 升级pip(python -m pip install --upgrade pip)
  • Added the -Iv argument to pip (sudo pip install -Iv matplotlib==1.3.1) 在pip中添加了-Iv参数(sudo pip install -Iv matplotlib == 1.3.1)
  • Installed ez_setup (pip install ez_setup), for ez_setup the pip install worked. 已安装ez_setup(点安装ez_setup),对于ez_setup,点安装已成功进行。

Setup: Python 2.7.15rc1 Ubuntu 18.04 (bionic) 设置: Python 2.7.15rc1 Ubuntu 18.04(bionic)

Edit: I tested it a with a bunch of other packages and was able to install all of them properly. 编辑:我用一堆其他软件包对其进行了测试,并且能够正确安装所有这些软件包。 The ultimate goal is to install s4d. 最终目标是安装s4d。 I followed the instructions given here . 我按照这里给出的说明进行操作。 Under requirements matplotlib Version 1.3.1 is listed. 根据要求,列出了matplotlib版本1.3.1。 However which would be a proper replacement for 1.3.1? 但是,哪种方法可以替代1.3.1? Can I just upgrade to 1.4 ie.? 我可以升级到1.4即吗?

Edit 2: Complete Output 编辑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/

EDIT 3: libfreetype2 and libagg So we narrowed it down to libfreetype missing (and libagg). 编辑3:libfreetype2和libagg因此,我们将其范围缩小到缺少libfreetype(和libagg)。 After the recent update to Ubuntu 18.04 I had many issue with the font rendering. 在最近对Ubuntu 18.04进行更新之后,字体渲染出现了很多问题。 So I downgraded freetype as suggested here , with the following bash commands: 因此,我按照以下建议将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

I checked if freetype is installed with (which it is) 我检查了是否安装了freetype(是)

ldconfig -p | grep freetype

So I unmarked freetype6 and ran update, upgrade and dist-upgrade, and then checked if I could install matplotlib, resulting in the same error. 因此,我未标记freetype6并运行了update,upgrade和dist-upgrade,然后检查是否可以安装matplotlib,导致相同的错误。 Does anyone know how to solve this? 有谁知道如何解决这个问题? Do I have to edit something in the pkg-config? 我是否必须在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

Edit 4 / Preliminary Solution The package libfreetype6-dev (sudo apt-get install libfreetype6-dev) helped, so now the setup.py / pip finds the libfreetype. 编辑4 /初步解决方案软件包libfreetype6-dev(sudo apt-get install libfreetype6-dev)提供了帮助,因此setup.py / pip现在可以找到libfreetype。 However the new error I am facing is. 但是,我面临的新错误是。 But that is probably a new question 但这可能是一个新问题

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

Did you try to just install matplotlib1.4 and try if s4d works? 您是否尝试仅安装matplotlib1.4并尝试s4d是否有效? It might be that the installation guide was not updated since newer matplotlib versions came out. 由于出现了新的matplotlib版本,因此可能未更新安装指南。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM