1

As a requirement to install OCRopus, I have successfully installed matplotlib on Mac OS X 10.9.1 by pip:

$ sudo pip install matplotlib

But after installing OCRopus the test didn't work because of laking this module: matplotlib.backends._backend_gdk. Reading this document and this question convinced me that my problems might gone if I reinstall matplotlib through:

$ sudo port install py27-matplotlib +gtk2

But on Mac OS X 10.9.1 it seems there is a bug which I receive this error: Error: Dependency 'py27-pyobjc' not found.:

--->  Computing dependencies for py27-matplotlib
Error: Dependency 'py27-pyobjc' not found.
To report a bug, follow the instructions in the guide:
    http://guide.macports.org/#project.tickets
Error: Processing of port py27-matplotlib failed

All I need is to install different variant of matplotlib. This is what I get from port variants py27-matplotlib:

$ port variants py27-matplotlib
py27-matplotlib has the variants:
   cairo: Enable Cairo backends
   dvipng: Enable dvipng support
   ghostscript: Enable GhostScript support
   gtk2: Enable GTKAgg backend
   gtk3: Enable GTK3Agg backend
   latex: Enable LaTeX support
   pdftops: Enable pdftops support
   pyside: Enable PySide backend
   qt4: Enable QT4Agg backend
[+]tkinter: Enable tkAgg backend
   universal: Build for multiple architectures
   webagg: Enable WebAgg backend

Any idea how to get +gtk2 on Mac OS X 10.9.1? or how to make pip to install matplotlib with this particular settings?

sophros
  • 14,672
  • 11
  • 46
  • 75
Mehdi
  • 4,202
  • 5
  • 20
  • 36
  • Have you tried installing it via brew? –  Jan 22 '14 at 18:24
  • @EdgarAroutiounian not actually, because I thought it might leads to other problems. And after googling I found similar issue here in brew: https://github.com/Homebrew/homebrew-science/issues/53 – Mehdi Jan 22 '14 at 18:27

3 Answers3

2

It looks like you don't have the python library for objective-C installed. Did you double-check that you installed command line tools? Then try port install py27-pyobjc

I recommend installing it via brew because I think it's better maintained, and it'll choose the best backend for you. I had a lot of issues installing matplotlib, but eventually was able to get them resolved.

Cheers, Olga

Community
  • 1
  • 1
Olga Botvinnik
  • 1,564
  • 1
  • 14
  • 32
  • This is my ticket on macport: https://trac.macports.org/ticket/42230 if it helps. I have installed "Command Line Tools (OS X Mavericks) for Xcode - Late October 2013" manually, just like this: http://stackoverflow.com/questions/19907576/xcode-is-not-currently-available-from-the-software-update-server/19908327#19908327 Even I cannot run `port install py27-pyobjc`. – Mehdi Jan 22 '14 at 23:35
  • in order to use `brew` I need to remove `port`. Do you suggest me to that? :D This is another question of mine: http://stackoverflow.com/questions/21289974/python-package-management-in-mac-os-x – Mehdi Jan 22 '14 at 23:39
  • Thank you for your help. I tired brew but didn't work for me. Actually I gave up after few ties on resolving errors and warnings on `brew doctor`. – Mehdi Jan 26 '14 at 15:55
1

Specifically for mac: I had a similar issue in installing the matplotlib. Follow these instructions and you are done:

  1. Open terminal.

  2. Install python3 using brew. ( Ignore this step if you already have it) Note: To install brew:

    brew install python3
    
  3. Install freetype:

    brew install freetype
    
  4. Now install pkg-config using pip3:

    brew install pkg-config
    
  5. Finally install matplotlib:

    sudo pip3 install matplotlib
    

It's late but I hope this helps you.

MJH
  • 2,301
  • 7
  • 18
  • 20
Kripson21
  • 19
  • 5
0

It turns out problem was on my computer. I couldn't figure out the source of the problem. Finally, I tried out the process on a clean installed Mac OS X 10.9.1 with new Xcode command-line tools, and new MacPorts, and upgraded python 2.7.6, then it worked fine.

Mehdi
  • 4,202
  • 5
  • 20
  • 36