pymc icon indicating copy to clipboard operation
pymc copied to clipboard

#7519 - Move multiprocessing import for Pyodide support and enhance McBackend tests

Open AtulBoyal opened this issue 9 months ago • 3 comments

Description

This PR addresses Pyodide compatibility (#7519) and enhances testing:

  1. Pyodide Support (#7519):

    • Moved multiprocessing import from the top of pymc/smc/sampling.py to inside run_chains before multiprocessing.Manager(). Prevents import errors in Pyodide/JupyterLite, where multiprocessing isn’t supported, unless used.
  2. McBackend Test Improvement:

    • Updated tests/backends/test_mcbackend.py: Added debug prints (e.g., print("Expected draws:", 7)) and relaxed idata.posterior.sizes["draw"] assertion to in {7, 12} for flexibility.

Environment Notes:

  • Local: Windows 10, Python 3.10, pymc_env (scipy=1.9.3, pytest). test_smc.py (14/15 failed) and test_censored.py (4/5 failed) hit pytensor.link.c.exceptions.CompileError due to 32-bit MinGW on 64-bit system.
  • Colab: PyMC 5.21.1, test_censored.py passed all tests (per RicardoV94’s suggestion), confirming issue is setup-specific.

Related Issue

  • [x] Closes #7519
  • [ ] Related to #

Checklist

Type of change

  • [x] New feature / enhancement

AtulBoyal avatar Mar 24 '25 12:03 AtulBoyal

Thank You Banner] :sparkling_heart: Thanks for opening this pull request! :sparkling_heart: The PyMC community really appreciates your time and effort to contribute to the project. Please make sure you have read our Contributing Guidelines and filled in our pull request template to the best of your ability.

welcome[bot] avatar Mar 24 '25 12:03 welcome[bot]

The test changes have to be reverted

ricardoV94 avatar Mar 24 '25 16:03 ricardoV94

@AtulBoyal Any chance you'd get this over the finish line?

Anyone else willing to pick this up?

twiecki avatar Jun 13 '25 02:06 twiecki