The bioBakery help forum

Conda installed workflow: topological_sort() & unexpected keywork argument "reverse"

I have run the following comands to create a conda env with the biobakery workflow.
conda config --add channels defaults
conda config --add channels bioconda
conda config --add channels conda-forge
conda config --add channels biobakery
conda install -c biobakery biobakery_workflows

conda install python=3.7
conda install -c biobakery leveldb

### run demo
biobakery_workflows_databases --install wmgx_demo
wget https://github.com/biobakery/biobakery_workflows/raw/master/examples/tutorial/input/HD42R4_subsample.fastq.gz
wget https://github.com/biobakery/biobakery_workflows/raw/master/examples/tutorial/input/HD32R1_subsample.fastq.gz
wget https://github.com/biobakery/biobakery_workflows/raw/master/examples/tutorial/input/HD48R4_subsample.fastq.gz
wget https://github.com/biobakery/biobakery_workflows/raw/master/examples/tutorial/input/LD96R2_subsample.fastq.gz
wget https://github.com/biobakery/biobakery_workflows/raw/master/examples/tutorial/input/LV16R4_subsample.fastq.gz
wget https://github.com/biobakery/biobakery_workflows/raw/master/examples/tutorial/input/LV20R4_subsample.fastq.gz
mv *fastq.gz fastq/


## run demo 
biobakery_workflows wmgx --input fastq/  --output demo_output/ --bypass-strain-profiling --local-jobs 6 --threads 2

On the last line of code (biobakery_workflows), i get the following error:

Traceback (most recent call last):
      File "/    home/emilyw/.conda/envs/biobakery/bin/wmgx.py", line 183, in <module>
            workflow.go()
          File "/home/emilyw/.conda/envs/biobakery/lib/python3.7/site-packages/anadama2/workflow.py", line 775, in go
            task_idxs = nx.algorithms.dag.topological_sort(self.dag, reverse=True)
        **TypeError: topological_sort() got an unexpected keyword argument 'reverse'**

Based on similar issues on other packages, it looks like the issue might be with some version inconsistency? Maybe a python/leveldb issue?

Hi - Thank you for your detailed post! I think you are right that the error you are seeing is likely due to a version of a dependency. If you roll back your install of the python package networkx to < v2.0 it should resolve the issue. With the v2.0 release it looks like the networkx package modified the topological_sort function to no longer allow the reverse keyword argument and so you see an error with the newer package. We will work on our end to update the AnADAMA2 software to work with the latest networkx release.

Thank you,
Lauren

1 Like

Got it! Now Iā€™m having an issue where the biobakery_workflow is getting hung up on the environment solve. I deleted the old conda env and created a new one with the following cold.

conda create -n biobakery python=3.7
conda activate biobakery
pip install networkx==1.11

conda config --add channels defaults
conda config --add channels bioconda
conda config --add channels conda-forge
conda config --add channels biobakery

conda install -c biobakery biobakery_workflows  ## this is the step that will not process

Do I need to downgrade python to 2.7? I tried this and the env got hung up for a long time as well.

Great! No need to downgrade to python v2.7; you should be okay using python 3.7. The workflows do have a number of dependencies so the install might take a bit of time with conda. If you are familiar with Docker we host a workflows Dockerfile with all the dependencies.

Thank you,
Lauren

1 Like

Great! I was able to set it the environment by removing the python version flag all together (with the flag, it would not resolve).

For anyone who may have this issue later, this code worked:

conda create -n metagenome 
conda activate metagenome
conda config --add channels biobakery
conda install -c biobakery biobakery_workflows