Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

AnInnovativeCoder
Copy link

@AnInnovativeCoder AnInnovativeCoder commented Mar 24, 2025

Description

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

  1. Pyodide Support (Make multiprocessing import local to support pyodide #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

Checklist

Type of change

  • New feature / enhancement

Copy link

welcome bot commented Mar 24, 2025

Thank You Banner]
💖 Thanks for opening this pull request! 💖 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.

@ricardoV94
Copy link
Member

The test changes have to be reverted

@AnInnovativeCoder AnInnovativeCoder changed the title #7519 - Make multiprocessing import to local scope for Pyodide supportFix multiprocessing pyodide #7519 - Move multiprocessing import for Pyodide support and enhance McBackend tests Mar 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make multiprocessing import local to support pyodide
2 participants