Ubuntu running `pip install` gives error 'The

2019-01-12 23:01发布

When performing pip install -r requirements.txt, I get the following error during the stage where it is installing matplotlib:

REQUIRED DEPENDENCIES AND EXTENSIONS
                 numpy: yes [not found. pip may install it below.]
              dateutil: yes [dateutil was not found. It is required for date
                        axis support. pip/easy_install may attempt to
                        install it after matplotlib.]
               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 [pyparsing was not found. It is required for
                        mathtext support. pip/easy_install may attempt to
                        install it after matplotlib.]
                 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.]

...

The following required packages can not be built:

                    * freetype

Shouldn't pip install -r requirements.txt also install freetype? How should freetype be installed in Ubuntu 12.04 so it works with matplotlib?

9条回答
相关推荐>>
2楼-- · 2019-01-12 23:29

I had the same issue with Python 3.6 on Windows, but then I switched to Python 3.5.2 and everything works fine.

查看更多
在下西门庆
3楼-- · 2019-01-12 23:35

I had to install libxft-dev in order to enable matplotlib on ubuntu server 14.04.

sudo apt-get install libfreetype6-dev libxft-dev

And then I could use

sudo easy_install matplotlib
查看更多
叼着烟拽天下
4楼-- · 2019-01-12 23:38

This command sudo apt-get install libfreetype6-dev failed for me on ubuntu 16.04,
The following packages have unmet dependencies: libfreetype6-dev : Depends: libfreetype6 (= 2.6.1-0.1ubuntu2) but 2.6.1-0.1ubuntu2.3 is to be installed

So I downloaded installed freetype from the source, credit to this guide

$ tar -xvjf freetype-x.y.tar.bz2  # extract the downloaded version file
$ cd freetype-x.y/ 
$ ./configure
$ make
$ sudo make install 

switched to virtualenv and pip install matplotlib and everything is working.

查看更多
倾城 Initia
5楼-- · 2019-01-12 23:39

None of the existing answers worked for me to upgrade matplotlib on Ubuntu. This is what ultimately work for me:

$ sudo apt-get install build-dep python-matplotlib
$ pip install matplotlib --upgrade
查看更多
Viruses.
6楼-- · 2019-01-12 23:41

This command will download all dependencies.

For python 2.x

sudo apt-get install python-matplotlib

For python 3.x

sudo apt-get install python3-matplotlib

After installing, you can try

(sudo) pip install matplotlib
查看更多
Anthone
7楼-- · 2019-01-12 23:41

I'm using Mint an none of this answers worked for me, I needed to:

sudo apt-get install build-essential g++
查看更多
登录 后发表回答