pythonqiime

install python collections


i'm trying to install a program called qiime http://qiime.org/install/install.html and I have finished installing prerequisites and building and installing as per the instructions but I'm stuck because python cant find defaultdict Counter. I googled to install defaultdict but I found nothing. How do you install defaultdict and counter? This is the error I'm getting. Thanks

casey@casey-laptop:~/Downloads/Qiime-1.5.0/tests$ cd
casey@casey-laptop:~$ align_seqs.py -h
Traceback (most recent call last):
  File "/usr/local/bin/align_seqs.py", line 15, in <module>
    from qiime.util import parse_command_line_parameters, get_options_lookup
  File "/usr/local/lib/python2.6/dist-packages/qiime/util.py", line 25, in <module>
    from collections import defaultdict, Counter
ImportError: cannot import name Counter

casey@casey-laptop:~/Downloads/Qiime-1.5.0/tests$ python all_tests.py 
Traceback (most recent call last):
  File "all_tests.py", line 10, in <module>
    from qiime.util import (parse_command_line_parameters, get_options_lookup,
  File "/usr/local/lib/python2.6/dist-packages/qiime/util.py", line 25, in <module>
    from collections import defaultdict, Counter
ImportError: cannot import name Counter

Solution

  • That qiime program seems to use the Counter class of the collections module. However that was introduced with Python 2.7 and you use Python 2.6.

    So updating your Python to 2.7 (or installing 2.7 besides 2.6) is the solution.