CheckM2 icon indicating copy to clipboard operation
CheckM2 copied to clipboard

TypeError: metaclass conflict

Open laczik-git opened this issue 10 months ago • 8 comments

Hi,

I'm having the following issue when trying to run checkm2:

$ checkm2 database --download --path ./ Traceback (most recent call last): File "/anaconda3/miniforge-install/envs/checkm2/bin/checkm2", line 27, in from checkm2 import predictQuality File "/anaconda3/miniforge-install/envs/checkm2/lib/python3.6/site-packages/checkm2/predictQuality.py", line 1, in from checkm2 import modelProcessing File "/anaconda3/miniforge-install/envs/checkm2/lib/python3.6/site-packages/checkm2/modelProcessing.py", line 17, in from tensorflow import keras File "/anaconda3/miniforge-install/envs/checkm2/lib/python3.6/site-packages/tensorflow/init.py", line 41, in from tensorflow.python.tools import module_util as _module_util File "/anaconda3/miniforge-install/envs/checkm2/lib/python3.6/site-packages/tensorflow/python/init.py", line 41, in from tensorflow.python.eager import context File "/anaconda3/miniforge-install/envs/checkm2/lib/python3.6/site-packages/tensorflow/python/eager/context.py", line 28, in from absl import logging File "/anaconda3/miniforge-install/envs/checkm2/lib/python3.6/site-packages/absl/logging/init.py", line 97, in from absl import flags File "/anaconda3/miniforge-install/envs/checkm2/lib/python3.6/site-packages/absl/flags/init.py", line 35, in from absl.flags import _argument_parser File "/anaconda3/miniforge-install/envs/checkm2/lib/python3.6/site-packages/absl/flags/_argument_parser.py", line 82, in class ArgumentParser(Generic[_T], metaclass=_ArgumentParserCache): TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases

conda version: 23.3.1 mamba version: 1.4.2 Python 3.6.15

laczik-git avatar Mar 28 '24 07:03 laczik-git

Having the same issue when installing from conda (mamba): mamba create -n checkm2 -c bioconda -c conda-forge checkm2

Installing using the yml file works fine though (with mamba): mamba env create -n checkm2 -f checkm2.yml mamba activate checkm2 and pip install CheckM2

bartns avatar Apr 02 '24 12:04 bartns

Having the same issue when installing from conda (mamba): mamba create -n checkm2 -c bioconda -c conda-forge checkm2

Installing using the yml file works fine though (with mamba): mamba env create -n checkm2 -f checkm2.yml mamba activate checkm2 and pip install CheckM2

Thank You!

I would say it worked like a charm, but I had to tinker with DIAMOND to make it work. First, I got this issue:

Illegal instruction ERROR: Error: DIAMOND failed to generate output.

I decided to update Diamond with mamba update, which resolved the previous error, bringing up a new one:

Segmentation fault ERROR: No DIAMOND annotation was generated. Exiting

So I obliterated DIAMOND with conda remove and reinstalled the previous version 2.1.8 Now, it works like a charm.

Thanks again!

laczik-git avatar Apr 02 '24 13:04 laczik-git

Good that you got it working.

In my case it installs the diamond as it should from yaml file: - diamond=2.0.4 which diamond: /home/bart/miniforge3/envs/checkm2/bin/diamond and it's version: diamond version gives diamond version 2.0.4

bartns avatar Apr 02 '24 14:04 bartns

For me, simply explicitly updating to Python 3.8 in Mamba solved this bug: mamba install python=3.8

schmigle avatar May 06 '24 05:05 schmigle

It seems the problem is the diamond 2.0.4 itself. It may be necessary to update to 2.1.8 in the dependencies. I also tried to manually remove and reinstall DIAMOND with version 2.1.8, and it fixed the "DIAMOND failed to generate output" problem. This problem occured not just in the testrun but also in the predict workflow. So, the reinstalling solved the problem.

conda version: 23.3.1 mamba version: 1.4.2 Python 3.8.19

RolandWirth avatar May 21 '24 11:05 RolandWirth

Next version will update to most recent DIAMOND release and reformat the database to work with that so that will hopefully fix some of these issues.

chklovski avatar May 23 '24 03:05 chklovski

Even if I updated diamond to 2.1.8 or 2.1.9, this problem (metaclass conflict) still could not be solved... conda 24.5.0 mamba 1.5.8 Python 3.6.15

matao0229 avatar Jun 18 '24 14:06 matao0229

I also had this issue after installing with mamba and was able to fix with the python update suggested here as well as in issue #82 . No need to adjust diamond. I also suggest you update the installation instructions as suggested by https://github.com/chklovski/CheckM2/issues/82#issuecomment-1804166388 as that is a simple fix that does not need to wait for an updated version or any other changes!

$ mamba create --name checkm2_v1.0.2 -c bioconda -c conda-forge checkm2

$ mamba activate checkm2_v1.0.2

$ checkm2 -h
Traceback (most recent call last):
  File "/work/08922/rrohwer/ls6/miniforge3/envs/checkm2_v1.0.2/bin/checkm2", line 27, in <module>
    from checkm2 import predictQuality
  File "/work/08922/rrohwer/ls6/miniforge3/envs/checkm2_v1.0.2/lib/python3.6/site-packages/checkm2/predictQuality.py", line 1, in <module>
    from checkm2 import modelProcessing
  File "/work/08922/rrohwer/ls6/miniforge3/envs/checkm2_v1.0.2/lib/python3.6/site-packages/checkm2/modelProcessing.py", line 17, in <module>
    from tensorflow import keras
  File "/work/08922/rrohwer/ls6/miniforge3/envs/checkm2_v1.0.2/lib/python3.6/site-packages/tensorflow/__init__.py", line 41, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "/work/08922/rrohwer/ls6/miniforge3/envs/checkm2_v1.0.2/lib/python3.6/site-packages/tensorflow/python/__init__.py", line 41, in <module>
    from tensorflow.python.eager import context
  File "/work/08922/rrohwer/ls6/miniforge3/envs/checkm2_v1.0.2/lib/python3.6/site-packages/tensorflow/python/eager/context.py", line 28, in <module>
    from absl import logging
  File "/work/08922/rrohwer/ls6/miniforge3/envs/checkm2_v1.0.2/lib/python3.6/site-packages/absl/logging/__init__.py", line 97, in <module>
    from absl import flags
  File "/work/08922/rrohwer/ls6/miniforge3/envs/checkm2_v1.0.2/lib/python3.6/site-packages/absl/flags/__init__.py", line 35, in <module>
    from absl.flags import _argument_parser
  File "/work/08922/rrohwer/ls6/miniforge3/envs/checkm2_v1.0.2/lib/python3.6/site-packages/absl/flags/_argument_parser.py", line 82, in <module>
    class ArgumentParser(Generic[_T], metaclass=_ArgumentParserCache):
TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases

$ mamba install python=3.8

$ checkm2 -h
		  ____ _               _    __  __ ____
 		 / ___| |__   ___  ___| | _|  \/  |___ \
 		| |   | '_ \ / _ \/ __| |/ / |\/| | __) |
 		| |___| | | |  __/ (__|   <| |  | |/ __/
 		 \____|_| |_|\___|\___|_|\_\_|  |_|_____|

                ...::: CheckM2 v1.0.2 :::...

  General usage:
    predict         -> Predict the completeness and contamination of genome bins in a folder. Example usage:

	checkm2 predict --threads 30 --input <folder_with_bins> --output-directory <output_folder>
    testrun         -> Runs Checkm2 on internal test genomes to ensure it runs without errors. Example usage:

	 checkm2 testrun --threads 10
    database        -> Download and set up required CheckM2 DIAMOND database for annotation

  Use checkm2 <command> -h for command-specific help.

Thank you! Robin

rrohwer avatar Sep 07 '24 18:09 rrohwer

I had the same issue after using conda for installation, and updating to python=3.8 solved the issue for me as well :)

zehanna avatar Oct 11 '24 16:10 zehanna