Skip to content

Conversation

@sanroman-24
Copy link

Description

When running the Cluster module on the python3 branch, the following error occurs:

AttributeError: 'NDHistogram' object has no attribute 'items'

This happens because the code in Cluster/DpEngine.py assumed the input histogram was a Python dict and called .items(). In reality, on the Python 3 branch, the object is a data.Patient.NDHistogram, which exposes .iteritems() (a custom method retained from Python 2 style) and _hist_array.

Fix

Updated DpEngine.init to handle both dict-like inputs and NDHistogram objects.

Added a fallback using .iteritems() to maintain compatibility.

This ensures clustering runs correctly on the Python 3 branch.

Environment

To simplify setup for Python 3 users, I’ve added a conda environment file (phylogicndt_py3.yml) with tested dependencies. This avoids ABI conflicts by using conda for the scientific stack and pip only where required.

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.

1 participant