Multiqc raises the "cannot import name 'gcd' from 'fractions'" error
3
0
Entering edit mode
3.0 years ago

I installed multiqc. But whenever I try to run it this happens.

Please help....

(rna-seq) sabbir@sabbir-VirtualBox:~/Share/week4$ multiqc -h
Traceback (most recent call last):
  File "/home/sabbir/miniconda3/envs/rna-seq/bin/multiqc", line 6, in <module>
    from multiqc.__main__ import multiqc
  File "/home/sabbir/miniconda3/envs/rna-seq/lib/python3.9/site-packages/multiqc/__init__.py", line 16, in <module>
    from .multiqc import run
  File "/home/sabbir/miniconda3/envs/rna-seq/lib/python3.9/site-packages/multiqc/multiqc.py", line 39, in <module>
    from .plots import table
  File "/home/sabbir/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/sabbir/miniconda3/envs/rna-seq/lib/python3.9/site-packages/multiqc/utils/mqc_colour.py", line 7, in <module>
    import spectra
  File "/home/sabbir/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/sabbir/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/sabbir/miniconda3/envs/rna-seq/lib/python3.9/site-packages/colormath/color_conversions.py", line 13, in <module>
    import networkx
  File "/home/sabbir/miniconda3/envs/rna-seq/lib/python3.9/site-packages/networkx/__init__.py", line 114, in <module>
    import networkx.generators
  File "/home/sabbir/miniconda3/envs/rna-seq/lib/python3.9/site-packages/networkx/generators/__init__.py", line 14, in <module>
    from networkx.generators.intersection import *
  File "/home/sabbir/miniconda3/envs/rna-seq/lib/python3.9/site-packages/networkx/generators/intersection.py", line 13, in <module>
    from networkx.algorithms import bipartite
  File "/home/sabbir/miniconda3/envs/rna-seq/lib/python3.9/site-packages/networkx/algorithms/__init__.py", line 16, in <module>
    from networkx.algorithms.dag import *
  File "/home/sabbir/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/sabbir/miniconda3/envs/rna-seq/lib/python3.9/fractions.py)
multiqc linux rna-sq • 4.1k views
ADD COMMENT
0
Entering edit mode

Hi, what happens? Please post status, warning, and / or error messages. Please describe that data that you are QCing.

ADD REPLY
0
Entering edit mode
(rna-seq) sabbir@sabbir-VirtualBox:~/Share/week4$ multiqc -h
Traceback (most recent call last):
  File "/home/sabbir/miniconda3/envs/rna-seq/bin/multiqc", line 6, in <module>
    from multiqc.__main__ import multiqc
  File "/home/sabbir/miniconda3/envs/rna-seq/lib/python3.9/site-packages/multiqc/__init__.py", line 16, in <module>
    from .multiqc import run
  File "/home/sabbir/miniconda3/envs/rna-seq/lib/python3.9/site-packages/multiqc/multiqc.py", line 39, in <module>
    from .plots import table
  File "/home/sabbir/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/sabbir/miniconda3/envs/rna-seq/lib/python3.9/site-packages/multiqc/utils/mqc_colour.py", line 7, in <module>
    import spectra
  File "/home/sabbir/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/sabbir/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/sabbir/miniconda3/envs/rna-seq/lib/python3.9/site-packages/colormath/color_conversions.py", line 13, in <module>
    import networkx
  File "/home/sabbir/miniconda3/envs/rna-seq/lib/python3.9/site-packages/networkx/__init__.py", line 114, in <module>
    import networkx.generators
  File "/home/sabbir/miniconda3/envs/rna-seq/lib/python3.9/site-packages/networkx/generators/__init__.py", line 14, in <module>
    from networkx.generators.intersection import *
  File "/home/sabbir/miniconda3/envs/rna-seq/lib/python3.9/site-packages/networkx/generators/intersection.py", line 13, in <module>
    from networkx.algorithms import bipartite
  File "/home/sabbir/miniconda3/envs/rna-seq/lib/python3.9/site-packages/networkx/algorithms/__init__.py", line 16, in <module>
    from networkx.algorithms.dag import *
  File "/home/sabbir/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/sabbir/miniconda3/envs/rna-seq/lib/python3.9/fractions.py)
ADD REPLY
0
Entering edit mode

It shows this error.. Sorry I'm new here, I'm trying but couldn't upload the screenshot

ADD REPLY
1
Entering edit mode

Hi, you're doing the right thing by copy-pasting the error. Uploading a screenshot of plain text is counter-productive. Copy-pasting it here is the right way to go. GenoMax and I have formatted your error so it can be read easier. You can do it yourself with the 101010 button on the toolbar.

code_formatting

ADD REPLY
0
Entering edit mode

Thanks for the help.

ADD REPLY
0
Entering edit mode

Thank you guys problem solved!

ADD REPLY
0
Entering edit mode

I've moved the helpful comments to answers. Please accept the answer(s) that helped you solve your problem. To accept an answer, click the grey check mark on the left side of the answer.

upvote_bookmark_accept

ADD REPLY
0
Entering edit mode

Can you post the output of conda list? That will help me track down the versions of networkx that need to have their metadata patched.

ADD REPLY
0
Entering edit mode

x-ref MultiQC GitHub issue about this: https://github.com/ewels/MultiQC/issues/1413 - I guess that we just have to wait for the next release of networkx. But it would still be good to hear what version people are running when they hit this problem. Help very welcome! :)

ADD REPLY
2
Entering edit mode
3.0 years ago
Carambakaracho ★ 3.2k

This is most likely a simple dependency problem due to python 3.9: https://stackoverflow.com/questions/66174862/import-error-cant-import-name-gcd-from-fractions

Easiest would be if you install a virtual environment with Python 3.8 or earlier...

ADD COMMENT
2
Entering edit mode
3.0 years ago
GenoMax 141k

It appears that python 3.9 may not be working with multiqc. You may need to specify python=3.7 when you install with conda.

ADD COMMENT
1
Entering edit mode
3.0 years ago
Phil Ewels ★ 1.4k

This appears to be a problem with the networkx dependency for MultiQC. Upgrading to version 2.5.1 solves the problem (conda install networkx=2.5.1).

See https://github.com/ewels/MultiQC/issues/1413 for discussion. I've updated the package version pin in MultiQC which will go out in the next release.

ADD COMMENT

Login before adding your answer.

Traffic: 2583 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