popgenmethods / momi2

Infer demographic history with the Moran model
GNU General Public License v3.0
47 stars 11 forks source link

Update dependency on networkx #38

Closed alanaw1 closed 4 years ago

alanaw1 commented 4 years ago

When installing momi2 into a conda environment, the installation process automatically installs some dependent modules, including one called networkx. In October 2019 version 2.4 of networkx was released, and this new version introduced the attribute nodes to a graph object to replace the old attribute node. Because momi2 seems to continue using networkx's old attribute-calling syntax, when it is performing optimization, functions in the events.py (./momi/events.py) script depending on graph construction will fail to run when called.

Concretely, this might result in errors like

AttributeError: 'DiGraph' object has no attribute 'node'

which I ran into a couple of times.

The syntax for momi2 scripts that rely on networkx should be updated to keep up with version 2.4's syntax. Alternatively, I resolved my problem by first installing an older version of networkx (e.g., version 2.2 will do) and then installing momi2:

  1. Run conda install networkx==2.2
  2. Run conda install momi -c conda-forge -c bioconda -c jackkamm
  3. You might have to tell the installation engine to not update networkx in Step 2.
alanaw1 commented 4 years ago

I just realized this exact issue is raised in #33.