# Issues in first pymc3 program from the documentation

**URL:** <https://discourse.pymc.io/t/issues-in-first-pymc3-program-from-the-documentation/4163>\
**Category:** Questions\
**Created:** [December 1, 2019, 12:13am UTC](https://discourse.pymc.io/t/issues-in-first-pymc3-program-from-the-documentation/4163 "2019-12-01T00:13:58Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alhpa\_Delta](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/alhpa_delta/32/2003_2.png) [@Alhpa\_Delta](https://discourse.pymc.io/u/Alhpa_Delta)\
**Post date:** [December 1, 2019, 12:13am UTC](https://discourse.pymc.io/t/issues-in-first-pymc3-program-from-the-documentation/4163/1 "2019-12-01T00:13:58Z")

</div>

I am just getting started with PyMC3. And the first program I wrote was the one given in  
the introduction ([https://docs.pymc.io/history.html](https://docs.pymc.io/history.html)),i.e. the bioassay\_model. However, I am running into a few issues and I was wondering if someone could help me figure them out.  
I am working in Windows 10 on a machine which also has a GPU. I am using the anaconda command prompt (NOT jupyter notebook).  
Following are the issues I am trying to figure out:

1. There is a line in the code which says  
trace = sample(1000, njobs=2)  
This gives an error:  
TypeError: function() got an unexpected keyword argument ‘njobs’  
It does not give an error if I remove njobs. But I was wondering what it is and if it is there in the official docs then maybe I need to do something on my side to get it to work.

2. If I run the program by removing njobs then it starts executing but gives a Runtime Error with the message “An attempt has been made to start a new process before the current process has finished its bootstrapping phase.”  
I tried to search for a way to fix this and used cores=1 from this ([Pymc3 getting stuck after initialization](https://discourse.pymc.io/t/pymc3-getting-stuck-after-initialization/2535))  
and it runs now. Is this the “optimum” way to fix this or there is somethign else which is better?

3. The program isnt “initializing NUTS using ADVI”. Instead it says “Initializing NUTS using jitter+adapt\_diag”. Why is it doing that and how can I get it to use ADVI?

4. Plotting: since I am not in jupyter, how do get to display the plot. normally in matplotlib i would do something like plt.show() but that option does not seem to work here.

5.Even though the program runs, I do not get the message regarding Average Loss and “Convergence archived at 11900”.

Sorry, about the long list, but if someone could help me figure out these, it would really be great.

---

<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:** [December 1, 2019, 8:50am UTC](https://discourse.pymc.io/t/issues-in-first-pymc3-program-from-the-documentation/4163/2 "2019-12-01T08:50:00Z")

</div>

1. 

> [@Alhpa\_Delta](#):
>
> trace = sample(1000, njobs=2)

It has been renamed to `cores` - try `trace = sample(1000, cores=2)`

1. 

> [@Alhpa\_Delta](#):
>
> Is this the “optimum” way to fix this or there is somethign else which is better?

Unfortunately, multi-processing under Windows is pretty bugy (also it doesnt play well with GPU) - for now you should do `cores=1`

1. You can do `trace = pm.sample(1000, cores=1, init='advi+adapt_diag')`, but the default `jitter+adapt_diag` is actually better and the recommended way to start

2. Hmm that should work in general here as well - in my command prompt under Linux I dont even need to do `plt.show()`

3. This message is related to ADVI, if you are not using ADVI init you wont see this message.

Overall, it seems we definitely need to update this outdated doc 😅

---

<div class="post-metadata">

**Author:** ![Alhpa\_Delta](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/alhpa_delta/32/2003_2.png) [@Alhpa\_Delta](https://discourse.pymc.io/u/Alhpa_Delta)\
**Post date:** [December 2, 2019, 2:22pm UTC](https://discourse.pymc.io/t/issues-in-first-pymc3-program-from-the-documentation/4163/3 "2019-12-02T14:22:37Z")

</div>

Thanks! yes, on the docs. I was wondering if this is the “wrong” doc I was looking at. If so which would be the right one.

---

<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:** [December 2, 2019, 3:02pm UTC](https://discourse.pymc.io/t/issues-in-first-pymc3-program-from-the-documentation/4163/4 "2019-12-02T15:02:25Z")

</div>

Usually [https://docs.pymc.io/notebooks/api\_quickstart.html](https://docs.pymc.io/notebooks/api_quickstart.html) should be up to date 🙂

---

<div class="post-metadata">

**Author:** ![AlexAndorra](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/alexandorra/32/9142_2.png) [@AlexAndorra](https://discourse.pymc.io/u/AlexAndorra)\
**Post date:** [December 2, 2019, 4:45pm UTC](https://discourse.pymc.io/t/issues-in-first-pymc3-program-from-the-documentation/4163/5 "2019-12-02T16:45:26Z")

</div>

I can try to update this NB Junpeng, if you think it’s important

---

<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:** [December 2, 2019, 10:10pm UTC](https://discourse.pymc.io/t/issues-in-first-pymc3-program-from-the-documentation/4163/6 "2019-12-02T22:10:10Z")

</div>

Please go ahead 🙂

---

<div class="post-metadata">

**Author:** ![AlexAndorra](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/alexandorra/32/9142_2.png) [@AlexAndorra](https://discourse.pymc.io/u/AlexAndorra)\
**Post date:** [December 3, 2019, 1:16pm UTC](https://discourse.pymc.io/t/issues-in-first-pymc3-program-from-the-documentation/4163/7 "2019-12-03T13:16:46Z")

</div>

Great, will look at that ASAP then!

---

<div class="post-metadata">

**Author:** ![AlexAndorra](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/alexandorra/32/9142_2.png) [@AlexAndorra](https://discourse.pymc.io/u/AlexAndorra)\
**Post date:** [December 30, 2019, 3:25pm UTC](https://discourse.pymc.io/t/issues-in-first-pymc3-program-from-the-documentation/4163/8 "2019-12-30T15:25:41Z")

</div>

@junpenglao as discussed I’m working on updating this doc, but I’m a bit confused by the format: [this file](https://github.com/pymc-devs/pymc3/blob/master/docs/source/history.rst) is a .rst and I’ve never worked with that.  
Do you know how I’m supposed to modify it, especially the code parts? Ideally these should be cells executed in a NB, but I’m under the impression that this is a sort of mock-up 🤔  
Thank you 🖖

---

<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:** [December 31, 2019, 7:36am UTC](https://discourse.pymc.io/t/issues-in-first-pymc3-program-from-the-documentation/4163/9 "2019-12-31T07:36:42Z")

</div>

This is a pure text file so the easiest way is to run the code in a notebook and copy the code and output to the file.

---

<div class="post-metadata">

**Author:** ![AlexAndorra](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/alexandorra/32/9142_2.png) [@AlexAndorra](https://discourse.pymc.io/u/AlexAndorra)\
**Post date:** [December 31, 2019, 1:46pm UTC](https://discourse.pymc.io/t/issues-in-first-pymc3-program-from-the-documentation/4163/10 "2019-12-31T13:46:29Z")

</div>

Ow ok, good to know, thanks! Updating the radon notebook now, but will do that after 😉

---

<div class="post-metadata">

**Author:** ![AlexAndorra](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/alexandorra/32/9142_2.png) [@AlexAndorra](https://discourse.pymc.io/u/AlexAndorra)\
**Post date:** [March 11, 2020, 9:05am UTC](https://discourse.pymc.io/t/issues-in-first-pymc3-program-from-the-documentation/4163/11 "2020-03-11T09:05:01Z")

</div>

This is updated now and will be up on the website when the next release is done 👌
