Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ubuntu running `pip install` gives error 'The following required packages can not be built: * freetype'

No. pip will not install system-level dependencies. This means pip will not install RPM(s) (Redhat based systems) or DEB(s) (Debian based systems).

To install system dependencies you will need to use one of the following methods depending on your system.

Ubuntu/Debian:

apt-get install libfreetype6-dev

To search for packages on Ubuntu/Debian based systems:

apt-cache search <string>

e.g:

apt-cache search freetype | grep dev

Redhat/CentOS/Fedora:

yum -y install freetype-devel

To search for packages on Redhat/CentOS/Fedora based systems:

yum search <string>

e.g:

yum search freetype | grep devel

Mac OS X: (via Homebrew)

brew install freetype

To search for packages on Mac OS X based systems:

brew search <string>

e.g:

brew search freetype

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

A workaround is to do sudo apt-get install pkg-config which I found in this github issue.


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

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