Skip to content

DOC+BUG: Confusing sampling example and RuntimeError on Windows in usage_overview.rst #8126

Description

@hridaiiiEx

Issue with current documentation:

Description

While following the usage_overview.rst documentation, I encountered two issues:

  1. The sampling example is confusing and differs from the official tutorial.
  2. The code raises a RuntimeError on Windows systems.
  3. There are broken Links in Documentation.

Problem 1: Confusing Sampling Example

In the documentation, the sampling is written as:

idata = pm.sample(1000, tune=2000, cores=2)

However, in the top recommended Youtube tutorial by Chris Fonnesbeck titled "Getting Started with PyMC" Youtube it is stated that sampling is mostly automatic and can be done simply with: pm.sample() without any arguments. This discrepancy can confuse beginners.

Problem 2: RuntimeError on Windows

Running the given example raises:

RuntimeError: 
An attempt has been made to start a new process before the current process has finished its bootstrapping phase

Image

Problem 3: Broken Links in Documentation

The "See also" section contains links such as:

  • Tutorials
  • Examples

However, clicking on these leads to a 404 error:
docs/source/learn/nb_tutorials/index.html
This suggests that the links are either outdated or incorrectly referenced.


Overall this section seems to be very confusing for beginners on a windows system.

Idea or request for content:

Summary

I prepared an alternative, clearer example for the usage_overview.rst page (same model as in the official tutorial). This PR will add the example as a separate folder rather than editing the existing file. I chose a new folder so the example can ship as:

  • a runnable .py example file,
  • a About_model.md (with plain text explanation),
  • images for equations/figures (so equations render the same across viewers),
  • and separate test/run instructions.

I used the guidance from Chris Fonnesbeck’s video (https://www.youtube.com/watch?v=jrU0UBr2z3k&t=1770s) which shows pm.sample() can be used with automatic defaults. I also encountered a Windows RuntimeError from multiprocessing and noticed several broken links in the docs (screenshots attached).


Problems found

  1. Sampling example mismatch / clarity

    • The docs use explicit arguments (e.g. pm.sample(1000, tune=2000, cores=2)), while the tutorial suggests sampling is mostly automatic (pm.sample()).
    • This confuses beginners — suggestion: show the simple default example and show that it runs correctly.
  2. RuntimeError on Windows

    • Running the example raises:
      RuntimeError: An attempt has been made to start a new process before the current process has finished its bootstrapping phase
      
    • Likely caused by using multiprocessing (e.g. cores>1) without protecting the sample call or without guidance for Windows users.
    • Suggested fixes: either wrap example usage in if __name__ == "__main__":, set cores=1 in docs for Windows, or add a short note about Windows multiprocessing.
  3. Broken links

    • Several “See also” links point to docs/source/learn/nb_tutorials/index.html and return 404. (Screenshot attached.)
    • Suggestion: update/remove links or point to correct pages.

Why a separate folder?

I created a separate folder because it lets me include:

  • a clean, runnable .py example (so users can copy-paste and run without editing rst code blocks),
  • about_model.md that explains how to run it,
  • high-quality images for equations (so they look consistent),
  • and additional plotting examples (I plan to add more az plots later).

If you prefer not to add a parallel folder, I can convert this to modifications of the existing .rst instead — please advise which you prefer.


What I can do next

  • I can open a Draft PR with the folder (incomplete links are noted in the PR) so maintainers can review structure first.
  • I can alternatively modify the existing usage_overview.rst if you prefer minimal changes.
  • I can include a Windows note and update examples to avoid the RuntimeError.
  • I can add more az plots in follow-up PRs.

Request

Please advise:

  1. Do you prefer an in-place edit of usage_overview.rst or adding the separate folder as an alternative example?
  2. If a new folder is acceptable, should I:
    • keep both (original + alternative), or
    • replace the existing example with the clearer version?

I plan to open a Draft PR

Image

with a proposed structure for review. (and will mark it “Closes #<issue_number>” once the maintainers ask me to). Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsinstallationissues about dependencies or installationneeds infoAdditional information required

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions