0

I am trying to run the following code:

import pymc as pm

alpha = 1.0/count_data.mean() #count_data is the variable that holds txtc
lambda_1 = pm.Exponential("lambda_1", alpha)
lambda_2 = pm.Exponential("lambda_2", alpha)

tau  = pm.DiscreteUniform("tau", lower=0, upper=n_count_data)

and keep getting this error:

RuntimeError: module compiled against API version 9 but this version of numpy is 6
Traceback (most recent call last):
File "bayestest.py", line 1, in <module>
import pymc as pm
File "/Library/Python/2.7/site-packages/pymc-2.3-py2.7-macosx-10.8-intel.egg/pymc/__init__.py", line 29, in <module>
from .CommonDeterministics import *
File "/Library/Python/2.7/site-packages/pymc-2.3-py2.7-macosx-10.8- intel.egg/pymc/CommonDeterministics.py", line 21, in <module>
from .utils import safe_len, stukel_logit, stukel_invlogit, logit, invlogit, value,  find_element

File "/Library/Python/2.7/site-packages/pymc-2.3-py2.7-macosx-10.8-intel.egg/pymc/utils.py", line 14, in from . import flib ImportError: numpy.core.multiarray failed to import

Is something wrong with my library installation versions?

  • The first line of the error seems pretty clear: RuntimeError: module compiled against API version 9 but this version of numpy is 6. You need to upgrade your numpy library. – Cilyan Nov 13 '13 at 23:09
  • How did you install it? – RyPeck Nov 14 '13 at 02:35

2 Answers2

0

If you are on OS X, an easy way to ensure that your Python scientific packages are all compatible is to simply install my Scipy Superpack, or if you don't mind having a second Python installation on your system, to install Anaconda.

Chris Fonnesbeck
  • 4,143
  • 4
  • 29
  • 30
0

I think the OP should accept the answer form Chris Fonnesbeck above.

The PyMC installation was trying to find a numpy installation and came across the version from of numpy that shipped with OS X, thus felt it was too outdated to use. It wasn't because that version of numpy was not good - in fact, it was tested with all other components of the system extensively before distribution, it is just that PyMC requires newer features.

In my personal opinion, the easiest way to go is to install Anaconda, and allow it to register in your system.

EDIT: Learned the etiquette a bit here, realize I shouldn't add the answer but comment - however, i don't have the privilege yet.

PaulDong
  • 711
  • 7
  • 19