Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install MatPlotLib on Mac 10.7 in virtualenv

Here what I try to do:

(SAASSenv)miki725mac:SAASSenv miki725$ python
Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
(SAASSenv)miki725mac:SAASSenv miki725$ 
(SAASSenv)miki725mac:SAASSenv miki725$ pip install http://downloads.sourceforge.net/project/matplotlib/matplotlib/matplotlib-1.0.1/matplotlib-1.0.1.tar.gz
Downloading/unpacking http://downloads.sourceforge.net/project/matplotlib/matplotlib/matplotlib-1.0.1/matplotlib-1.0.1.tar.gz
  Downloading matplotlib-1.0.1.tar.gz (13.3Mb): 13.3Mb downloaded
  Running setup.py egg_info for package from http://downloads.sourceforge.net/project/matplotlib/matplotlib/matplotlib-1.0.1/matplotlib-1.0.1.tar.gz
    basedirlist is: []
    ============================================================================
    BUILDING MATPLOTLIB
                matplotlib: 1.0.1
                    python: 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34)
                            [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]
                  platform: darwin

    REQUIRED DEPENDENCIES
                     numpy: 1.6.0
                 freetype2: 13.0.7

    OPTIONAL BACKEND DEPENDENCIES
                    libpng: 1.4.8
    Traceback (most recent call last):
      File "<string>", line 14, in <module>
      File "/var/folders/tk/xpmf2q_10qg45c9g_xzmvy4r0000gn/T/pip-02sOum-build/setup.py", line 162, in <module>
        if check_for_tk() or (options['build_tkagg'] is True):
      File "setupext.py", line 832, in check_for_tk
        (Tkinter.__version__.split()[-2], Tkinter.TkVersion, Tkinter.TclVersion))
    IndexError: list index out of range
    Complete output from command python setup.py egg_info:
    basedirlist is: []

============================================================================

BUILDING MATPLOTLIB

            matplotlib: 1.0.1

                python: 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34)

                        [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]

              platform: darwin



REQUIRED DEPENDENCIES

                 numpy: 1.6.0

             freetype2: 13.0.7



OPTIONAL BACKEND DEPENDENCIES

                libpng: 1.4.8

Traceback (most recent call last):

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

  File "/var/folders/tk/xpmf2q_10qg45c9g_xzmvy4r0000gn/T/pip-02sOum-build/setup.py", line 162, in <module>

    if check_for_tk() or (options['build_tkagg'] is True):

  File "setupext.py", line 832, in check_for_tk

    (Tkinter.__version__.split()[-2], Tkinter.TkVersion, Tkinter.TclVersion))

IndexError: list index out of range

----------------------------------------
Command python setup.py egg_info failed with error code 1
Storing complete log in /Users/miki725/.pip/pip.log

Please help me. If you need any additional info, please let me know. Thank you.

like image 711
miki725 Avatar asked Aug 04 '11 06:08

miki725


People also ask

Do you have to pip install matplotlib?

Matplotlib can be installed using pip. The following command is run in the command prompt to install Matplotlib. This command will start downloading and installing packages related to the matplotlib library. Once done, the message of successful installation will be displayed.

Does Python 3.10 support matplotlib?

Matplotlib 2.0. x supports Python versions 2.7 through 3.10.

What is the command for installing matplotlib?

If you are using the Python version that comes with your Linux distribution, you can install Matplotlib via your package manager, e.g.: Debian / Ubuntu: sudo apt-get install python3-matplotlib. Fedora: sudo dnf install python3-matplotlib. Red Hat: sudo yum install python3-matplotlib.


2 Answers

locojays line didn't work for me (osx 10.7, Python 2.7.2 via homebrew), I had to modify the command as follows:

pip install -e git+https://github.com/matplotlib/matplotlib.git#egg=matplotlib
like image 164
staticfloat Avatar answered Sep 21 '22 07:09

staticfloat


just do

pip install -e https://github.com/matplotlib/matplotlib.git matplotlib

or clone and then install

or have a look @

http://jholewinski.org/blog/installing-matplotlib-on-os-x-10-7-with-homebrew/

but it s not a lion problem just a python 2.7.2 bug. had the same problem on a colleagues snow leopard machine

suppose your are using brew

hope this helps

like image 32
jassinm Avatar answered Sep 20 '22 07:09

jassinm