Skip to content

ImportError: cannot import name CDM from pyHalo.preset_models (dependency/API mismatch) #100

@srividya-0001

Description

@srividya-0001

ImportError: cannot import name CDM from pyHalo.preset_models (dependency/API mismatch)

Hello maintainers,

While testing this repository on a clean Windows setup, I encountered a dependency/API mismatch that prevents running the Model_I simulation scripts.

Description

Running Model_I/sim_axion.py fails during import with:

ImportError: cannot import name 'CDM' from 'pyHalo.preset_models'

This happens before the script reaches execution, so it blocks cross-platform testing and reproducibility for new contributors.

Steps to Reproduce

  1. Clone the repository
  2. Create and activate a virtual environment (Windows) and install dependencies:
py -3.11 -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt
pip install -e .
  1. Run:
python Model_I/sim_axion.py

Observed Behavior

The script fails with:

ImportError: cannot import name 'CDM' from 'pyHalo.preset_models'

Environment:

  • OS: Windows
  • Python: 3.11

Installed pyHalo version:

python -c "import pyHalo; print(pyHalo.__version__)"

Output:

0.2.8

Additional check:

python -c "import pyHalo.preset_models as pm; print([x for x in dir(pm) if 'CDM' in x])"

Output:

[]

Expected Behavior

The simulation scripts should run successfully after installation.
Alternatively, the repository should pin a compatible pyHalo version and/or update the import statement according to the correct pyHalo API.

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions