Ubuntu error — cannot import name 'gcd' from 'fractions'

Viewed 863

I'm using Ubuntu to learn basic bioinformatics. I just downloaded multiqc using conda, but when I want to run multiqc, it returns: enter image description here

I am very naive and don't know how to solve this problem. ANY help would be highly appreciated. Thanks

3 Answers

I think gcd was moved to the math pack in 3.9. See https://docs.python.org/3/library/fractions.html

Changed in version 3.9: The math.gcd() function is now used to normalize the numerator and denominator. math.gcd() always return a int type. Previously, the GCD type depended on numerator and denominator.

I suggest you create a virtual environment with 3.8 and try that. There are tons of tutorials on how to do this.

As Andrew said, Python 3.8 can be installed virtually. However, I just asked Conda to reinstall the older version of python (3.8), and now it's working perfectly.

This problem happens when you have an outdated version of the networkx package, which is a MultiQC dependency. You can fix it by updating this package:

conda install networkx=2.5.1

The next release of MultiQC (v1.11) will specify that at least this version of networkx is required, to ensure Python 3.9 compatability.

GitHub issue where this was tracked down: https://github.com/ewels/MultiQC/issues/1413

Related