Skip to content

[BUG] 21cmMC fails to import with py21cmfast v4 (ModuleNotFoundError: py21cmfast._utils) #85

Description

@ayansark147

I am opening this issue to report a hard compatibility break between the current version of 21cmMC and the recent major release of py21cmfast (v4).
With the recent update of 21cmFAST to v4, the _utils.py has moved to the wrapper folder, thereby making most of the functions in 21cmMC erroneous as they use py21cmfast._utils

Steps to reproduce the behavior:

  1. Install the latest version of py21cmfast (v4.x.x) and 21cmMC.

  2. Attempt to import the core MCMC modules:4. Python

from py21cmmc import analyse
from py21cmmc import mcmc

Expected behavior:
21cmMC should successfully import and interface seamlessly with the v4 backend without triggering internal module import errors.

Actual Behavior:

The pipeline fails immediately upon import. Here is the traceback:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[3], line 14
     10 
     11 # Now the imports will work seamlessly!
     12 get_ipython().run_line_magic('matplotlib', 'inline')
     13 import numpy as np
---> 14 from py21cmmc import analyse
     15 from py21cmmc import mcmc
     16 import py21cmmc as p21mc

File ~/.venv/lib/python3.13/site-packages/py21cmmc/__init__.py:4
      1 """21CMMC: a package for running MCMC analyses using 21cmFAST."""
      3 __version__ = "1.0.0dev3"
----> 4 from .analyse import get_samples, load_primitive_chain
      5 from .core import (
      6     CoreCoevalModule,
      7     CoreLightConeModule,
   (...)
     10     NotSetupError,
     11 )
     12 from .cosmoHammer import HDFStorageUtil

File ~/.venv/lib/python3.13/site-packages/py21cmmc/analyse.py:11
      8 from pathlib import Path
      9 from py21cmfast import yaml
...
---> 15 from py21cmfast._utils import ParameterError
     17 from py21cmmc.ensemble import EnsembleSampler
     19 logger = getLogger()

ModuleNotFoundError: No module named 'py21cmfast._utils' 

Details:

  • OS: Windows WSL2/ Ubuntu 22.04
  • Python Version: 3.13.0
  • py21cmfast version: 4.2
  • 21cmMC: 1.0.0dev3

Additional context
Given the massive performance and structural upgrades in py21cmfast v4 (and the shift toward 21cmEMU), are there any ongoing branches or roadmaps for updating 21cmMC to support the v4 ecosystem? Let me know if there is anything I can test to help out!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    Priority

    None yet

    Effort

    None yet

    API Breaking

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions