walkloud
walkloud

Reputation: 41

pip install matplotlib fails on mavericks with homebrew

I am trying to install the Scipy python stack, but having issues.
I have a new mac os with mavericks (10.9).
I have installed homebrew and am using brew to manage installations.

I used

% brew install python

then (I verified pip is from my homebrew installation)

% pip install numpy [this works]

% pip install scipy [this works]

% pip install matplotlib  OR pip install http://downloads.sourceforge.net/project/matplotlib/matplotlib/matplotlib-1.3.1/matplotlib-1.3.1.tar.gz

Both fail with the same error. After checking the backend, I get

Fatal Python error: PyThreadState_Get: no current thread

The error message from mac os X (the pop up error window) shows errors very similar to those in the previous thread

Homebrew + Python on mac os x 10.8: Fatal Python error: PyThreadState_Get: no current thread importing mapnik

It seems I need to fix the python bindings, as some of them linked against the /System/Library python that ships with the mac. What is not clear to me from the above post is

  1. which of the Binary Images need to be "re-linked"? all of them? some seem quite general an not related to matplotlib

  2. how do I actually use install_name_tool to fix the link? As I mentioned, some seem quite general - do I really want to change the path? Do I cp the dylib from old to new?

I have also tried

brew uninstall python

and re-brewing, all to get the same error. I am trying not to use EPD because EPD installs its own libxml2 and others, which I need for other software I will install, and this has caused me problems on an old machine. I am open to considering a virtualenv, but was hoping to learn to just fix my current problem if possible.

Thanks,

Andre

PS, when pip install matplotlib`, the following warning appears, which seems odd because matplotlib is such a staple piece of software

You are installing an externally hosted file. Future versions of pip will default to disallowing externally hosted files.

You are installing a potentially insecure and unverifiable file. Future versions of pip will default to disallowing insecure files.

Upvotes: 4

Views: 3370

Answers (3)

Daming
Daming

Reputation: 1

brew install freetype

it works on mac os sierra!

Upvotes: -1

Andy Jackson
Andy Jackson

Reputation: 366

I had the same problem, and after some experimentation it seems that installing under Python 3 works more reliably. i.e. this installed without error:

pip3 install matplotlib

I then had to re-install everything else using pip3, and make sure I was running under python3 at execution time.

Upvotes: 1

Chris Thompson
Chris Thompson

Reputation: 91

This is an issue in pygtk. You can test it with brew (it should throw the same error):

brew test pygtk

I ran into the same problem, and got past that error with the following steps from https://github.com/mxcl/homebrew/issues/13654

  • brew rm py2cairo
  • brew install py2cairo

You can test that pygtk is working using brew test pygtk again.

I'm still having other problems getting pip install matplotlib to work, so you may also run into more problems, but that should get you past that particular issue.

Upvotes: 5

Related Questions