Closed FrankYu closed 8 years ago
You haven't got matplotlib (a PyMC dependency) installed. Check your install log.
If you also installed matplotlib and have the same error, I got the same problem, and solved it. check if you install fake module, "pylab".
import pylab pylab.version
if you see sth like a version 0.1.0, it means you installed a fake. pymc modules would have 'try and exception' to change 'import pylab' into matplotlib.pylab. If you installed the fake pylon module, this exception fails and you get an error.
In sum, check if you have pylab module, and then pip uninstall pylab.
Hi, I have install pymc from source.
git describe
v2.3.6-68-g48cd027
python -c 'import pymc'
I can see this module, but I met error when try the example in the https://github.com/pymc-devs/pymc
cat mymodel.py
Import relevant modules
import pymc import numpy as np
Some data
n = 5 * np.ones(4, dtype=int) x = np.array([-.86, -.3, -.05, .73])
Priors on unknown parameters
alpha = pymc.Normal('alpha', mu=0, tau=.01) beta = pymc.Normal('beta', mu=0, tau=.01)
Arbitrary deterministic function of parameters
@pymc.deterministic def theta(a=alpha, b=beta): """theta = logit^{-1}(a+b)""" return pymc.invlogit(a + b * x)
Binomial likelihood for data
d = pymc.Binomial('d', n=n, p=theta, value=np.array([0., 1., 3., 5.]), observed=True)
cat test.py
import pymc import mymodel
S = pymc.MCMC(mymodel, db='pickle') S.sample(iter=10000, burn=5000, thin=2) pymc.Matplot.plot(S)
python test.py
[-----------------46% ] 4691 of 10000 complete in 0.5 sec [-----------------76%-------- ] 7631 of 10000 complete in 1.0 sec [-----------------88%------------- ] 8868 of 10000 complete in 1.5 sec [-----------------100%-----------------] 10000 of 10000 complete in 1.7 sec Traceback (most recent call last): File "test.py", line 6, in
pymc.Matplot.plot(S)
AttributeError: 'module' object has no attribute 'Matplot'