# Latest PyMC3 from git fails to sample

**URL:** https://discourse.pymc.io/t/latest-pymc3-from-git-fails-to-sample/547
**Category:** Questions
**Created:** [November 12, 2017, 7:22pm UTC](https://discourse.pymc.io/t/latest-pymc3-from-git-fails-to-sample/547 "2017-11-12T19:22:04Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![jonsjoberg](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/jonsjoberg/32/24_2.png) [@jonsjoberg](https://discourse.pymc.io/u/jonsjoberg)
#### Post date: [November 12, 2017, 7:22pm UTC](https://discourse.pymc.io/t/latest-pymc3-from-git-fails-to-sample/547/1 "2017-11-12T19:22:05Z")

</div>

When I’m using the latest version of PyMC3 from github (pip install git+https://github.com/pymc-devs/pymc3) it fails to sample from this model (from the Bayesian Analysis with Python book):

```
with pm.Model() as pearson_model:

mu = pm.Normal('mu', mu=data.mean(0), sd=10, shape=2)
sigma_1 = pm.HalfNormal('sigma_1', 10)
sigma_2 = pm.HalfNormal('sigma_2', 10)
rho = pm.Uniform('ro', -1, 1)

cov = pm.math.stack(([sigma_1**2, sigma_1*sigma_2*rho], 
                     [sigma_1*sigma_2*rho, sigma_2**2]))

y_pred = pm.MvNormal('y_pred', mu=mu, cov=cov, observed=data)

start = pm.find_MAP()
step = pm.NUTS(scaling=start)
trace_pearson = pm.sample(2000, step=step, start=start)

```

I don’t get any errors, but it never seems to be able to draw a single sample. However when I’m using the released version of PyMC3 it works, so I’m thinking it’s a regression? Is it known? If not should I submit an issue in github?

---

<div class="post-metadata">

### Author: ![jonsjoberg](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/jonsjoberg/32/24_2.png) [@jonsjoberg](https://discourse.pymc.io/u/jonsjoberg)
#### Post date: [November 12, 2017, 7:30pm UTC](https://discourse.pymc.io/t/latest-pymc3-from-git-fails-to-sample/547/2 "2017-11-12T19:30:19Z")

</div>

And this is the code to generate the data:

```
np.random.seed(314)
N = 100
alpha_real = 2.5
beta_real = 0.9
eps_real = np.random.normal(0, .5, size=N)

x = np.random.normal(10, 1, N)
y_real = alpha_real + beta_real * x
y = y_real + eps_real
data = np.stack((x, y)).T
```

---

<div class="post-metadata">

### Author: ![junpenglao](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/junpenglao/32/8_2.png) [@junpenglao](https://discourse.pymc.io/u/junpenglao)
#### Post date: [November 12, 2017, 7:55pm UTC](https://discourse.pymc.io/t/latest-pymc3-from-git-fails-to-sample/547/3 "2017-11-12T19:55:42Z")

</div>

What system are you on? Try setting the njobs=1 to sample multiple chains sequentially.

---

<div class="post-metadata">

### Author: ![jonsjoberg](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/jonsjoberg/32/24_2.png) [@jonsjoberg](https://discourse.pymc.io/u/jonsjoberg)
#### Post date: [November 12, 2017, 9:11pm UTC](https://discourse.pymc.io/t/latest-pymc3-from-git-fails-to-sample/547/4 "2017-11-12T21:11:48Z")

</div>

I’m on Mac OS X 10.13.2 Beta on this machine. I will try with sequential chains when I get some time, hopefully later tonight.

---

<div class="post-metadata">

### Author: ![jonsjoberg](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/jonsjoberg/32/24_2.png) [@jonsjoberg](https://discourse.pymc.io/u/jonsjoberg)
#### Post date: [November 13, 2017, 7:15pm UTC](https://discourse.pymc.io/t/latest-pymc3-from-git-fails-to-sample/547/5 "2017-11-13T19:15:51Z")

</div>

Yeah, with njobs=1 it worked, why is that?

---

<div class="post-metadata">

### Author: ![junpenglao](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/junpenglao/32/8_2.png) [@junpenglao](https://discourse.pymc.io/u/junpenglao)
#### Post date: [November 13, 2017, 7:52pm UTC](https://discourse.pymc.io/t/latest-pymc3-from-git-fails-to-sample/547/6 "2017-11-13T19:52:22Z")

</div>

I think it is some kind of pickling issue, I have yet to pin down where is the problem… and seems it only happens in mac…
