51

When I try to upgrade my matplotlib using pip, it outputs:

Downloading/unpacking matplotlib from https://pypi.python.org/packages/source/m/matplotlib/matplotlib-1.4.0.tar.gz#md5=1daf7f2123d94745feac1a30b210940c
  Downloading matplotlib-1.4.0.tar.gz (51.2MB): 51.2MB downloaded
  Running setup.py (path:/tmp/pip_build_root/matplotlib/setup.py) egg_info for package matplotlib
    ============================================================================
    Edit setup.cfg to change the build options

    BUILDING MATPLOTLIB
                matplotlib: yes [1.4.0]
                    python: yes [2.7.6 (default, Mar 22 2014, 22:59:38)  [GCC
                            4.8.2]]
                  platform: yes [linux2]

    REQUIRED DEPENDENCIES AND EXTENSIONS
                     numpy: yes [version 1.8.2]
                       six: yes [using six version 1.7.3]
                  dateutil: yes [using dateutil version 2.2]
                   tornado: yes [using tornado version 4.0.1]
                 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.]
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/tmp/pip_build_root/matplotlib/setup.py", line 154, in <module>
        result = package.check()
      File "setupext.py", line 940, in check
        if 'No such file or directory\ngrep:' in version:
    TypeError: argument of type 'NoneType' is not iterable
    Complete output from command python setup.py egg_info:
    ============================================================================

Edit setup.cfg to change the build options



BUILDING MATPLOTLIB

            matplotlib: yes [1.4.0]

                python: yes [2.7.6 (default, Mar 22 2014, 22:59:38)  [GCC

                        4.8.2]]

              platform: yes [linux2]



REQUIRED DEPENDENCIES AND EXTENSIONS

                 numpy: yes [version 1.8.2]

                   six: yes [using six version 1.7.3]

              dateutil: yes [using dateutil version 2.2]

               tornado: yes [using tornado version 4.0.1]

             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.]

Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/tmp/pip_build_root/matplotlib/setup.py", line 154, in <module>

    result = package.check()

  File "setupext.py", line 940, in check

    if 'No such file or directory\ngrep:' in version:

TypeError: argument of type 'NoneType' is not iterable

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/matplotlib
Storing debug log for failure in /home/username/.pip/pip.log

In the tail of the log it says:

Exception information:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/pip-1.5.6-py2.7.egg/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/local/lib/python2.7/dist-packages/pip-1.5.6-py2.7.egg/pip/commands/install.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/usr/local/lib/python2.7/dist-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 1229, in prepare_files
    req_to_install.run_egg_info()
  File "/usr/local/lib/python2.7/dist-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 325, in run_egg_info
    command_desc='python setup.py egg_info')
  File "/usr/local/lib/python2.7/dist-packages/pip-1.5.6-py2.7.egg/pip/util.py", line 697, in call_subprocess
    % (command_desc, proc.returncode, cwd))
InstallationError: Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/matplotlib

Why did it fail? Many thanks!

2
  • It might be helpful if You tell us what OS You are using and the exact pip command You issued. Commented Sep 5, 2014 at 9:12
  • I said it in the title. Ubuntu 14.04. But, anyway, the answer below helped me. Thank you so much! :-) Commented Sep 7, 2014 at 17:53

9 Answers 9

77

This is a known bug that has been fixed (https://github.com/matplotlib/matplotlib/pull/3414) on master.

The bug is in the handling of searching for a freetype installation. If you install the Linux package freetype-dev, you will avoid this bug and be able to compile matplotlib.

sudo apt-get install libfreetype6-dev
Sign up to request clarification or add additional context in comments.

6 Comments

Is freetype6-dev (and perhaps libxft-dev for Ubuntu 14 server) installed with apt-get build-dep python-matplotlib?
I can confirm this applies to Ubuntu 16.04 too and the indicated solution works.
@Vanuan, thank you. I can confirm on Ubuntu 16.04, using Python 2.7, that installing libfreetype6-dev as worked as a workaround. Appreciate it.
needed to install libxft-dev also.
Thank!! works for me in Ubuntu 14.04 and python3 with the command "apt-get build-dep python3-matplotlib"
|
69

On Ubuntu 14 server, you also need to install libxft-dev

sudo apt-get install libfreetype6-dev libxft-dev

2 Comments

It seems very difficult to make out what needs to be done. However, it looks like on Ubuntu 14 sudo apt-get install libfreetype6-dev libxft-dev followed by sudo pip install matplotlib WORKS !!
This is also required for Bash on Windows 10.
12

I had the same issues trying to install matplotlib on Python 3 using pip3, and it seems that this problem is related to a bare-bones installation of Python 3, and doing a:

sudo apt-get build-dep matplotlib

followed by

sudo pip3 install matplotlib 

is probably a better solution than selectively installing only the libraries related to matplotlib.

2 Comments

In Ubuntu 15.04, this wants to install 419 packages totaling 1 GB.
@knite That is tradeoff between manual dependency management and convenience.
3

Since mac doesn't have apt-get you, on OSX you may need to do:

brew install freetype

then you can run:

pip install matplotlib

1 Comment

I also had to install pkg-config with brew install pkg-config and then it worked.
1

Found this page while looking answer for fedora 24.

RPM solution is:

dnf install freetype-devel

Comments

1

If you re running Ubuntu server 14.04 u should add this font dependency

sudo apt-get install libxft-dev

Source

Comments

0

I was trying too update directly using sudo pip but changes are not saved in last. So i first use update cmd in terminal:

sudo apt-get update

then i used sudo install:

sudo apt-get install libffi-dev

Finally its installed by doing this method.

1 Comment

While this code snippet may solve the question, including an explanation really helps to improve the quality of your post. Remember that you are answering the question for readers in the future, and those people might not know the reasons for your code suggestion. Please also try not to crowd your code with explanatory comments, this reduces the readability of both the code and the explanations!
0

For those on Fedora 25 hitting this thread, I needed these two packages to make it work:

sudo dnf install freetype-devel gcc-c++

Comments

0

This worked for me:

python -m pip install -U pip setuptools
python -m pip install matplotlib

For more details, follow : https://matplotlib.org/2.0.0/users/installing.html

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.