cannot import name 'gcd' from 'fractions'
2
0
Entering edit mode
3.6 years ago
h.gaikani • 0

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

>     > Traceback (most recent call last):   File
>     > "/home/gaikani/miniconda3/envs/rna-seq/bin/multiqc", line 6, in
>     > <module>
>     >     from multiqc.__main__ import multiqc   File "/home/gaikani/miniconda3/envs/rna-seq/lib/python3.9/site-packages/multiqc/__init__.py",
>     > line 16, in <module>
>     >     from .multiqc import run   File "/home/gaikani/miniconda3/envs/rna-seq/lib/python3.9/site-packages/multiqc/multiqc.py",
>     > line 39, in <module>
>     >     from .plots import table   File "/home/gaikani/miniconda3/envs/rna-seq/lib/python3.9/site-packages/multiqc/plots/table.py",
>     > line 9, in <module>
>     >     from multiqc.utils import config, report, util_functions, mqc_colour   File
>     > "/home/gaikani/miniconda3/envs/rna-seq/lib/python3.9/site-packages/multiqc/utils/mqc_colour.py",
>     > line 7, in <module>
>     >     import spectra   File "/home/gaikani/miniconda3/envs/rna-seq/lib/python3.9/site-packages/spectra/__init__.py",
>     > line 1, in <module>
>     >     from .core import COLOR_SPACES, Color, Scale   File "/home/gaikani/miniconda3/envs/rna-seq/lib/python3.9/site-packages/spectra/core.py",
>     > line 1, in <module>
>     >     from colormath import color_objects, color_conversions   File
> "/home/gaikani/miniconda3/envs/rna-seq/lib/python3.9/site-packages/colormath/color_conversions.py",
>     > line 13, in <module>
>     >     import networkx   File "/home/gaikani/miniconda3/envs/rna-seq/lib/python3.9/site-packages/networkx/__init__.py",
>     > line 114, in <module>
>     >     import networkx.generators   File "/home/gaikani/miniconda3/envs/rna-seq/lib/python3.9/site-packages/networkx/generators/__init__.py",
>     > line 14, in <module>
>     >     from networkx.generators.intersection import *   File "/home/gaikani/miniconda3/envs/rna-seq/lib/python3.9/site-packages/networkx/generators/intersection.py", line 13, in <module>
>     >     from networkx.algorithms import bipartite   File "/home/gaikani/miniconda3/envs/rna-seq/lib/python3.9/site-packages/networkx/algorithms/__init__.py",
>     > line 16, in <module>
>     >     from networkx.algorithms.dag import *   File "/home/gaikani/miniconda3/envs/rna-seq/lib/python3.9/site-packages/networkx/algorithms/dag.py",
>     > line 23, in <module>
>     >     from fractions import gcd ImportError: cannot import name 'gcd' from 'fractions'
>     > (/home/gaikani/miniconda3/envs/rna-seq/lib/python3.9/fractions.py)

I downloaded fastqc 10 minutes before that and it worked well, but multiqc does not.

Thanks for your help

ubuntu Linux python multiqc • 8.9k views
ADD COMMENT
2
Entering edit mode
3.6 years ago

Hello. It seems that in Python 3.9 gcd function is in module math not fractions.

You can either trace back the error and fix the import, or try downgrading python to other version like 3.6 or 3.8.

You can find better answer here in stackoverflow

ADD COMMENT
0
Entering edit mode

Thanks very much!

ADD REPLY
0
Entering edit mode
3.5 years ago
Phil Ewels ★ 1.4k

See the other biostars post about this and specifically my response for more details on this.

The conda recipe has since been updated so reinstalling from conda should solve the issue.

There is no need to downgrade Python, you just need to upgrade the networkx package.

ADD COMMENT

Login before adding your answer.

Traffic: 1886 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6