BigDataBiology / argNorm

ARG normalization by mapping to the ARO ontology.
MIT License
25 stars 4 forks source link

AttributeError: module 'collections' has no attribute 'Mapping' #34

Open VittoriaOssanna opened 6 months ago

VittoriaOssanna commented 6 months ago

Hello everyone,

I was trying to run argNorm on data coming from amrfinderplus. Nevertheless, I am encountering an error. I tried also cloning this repo and using the examples files to run the analysis, still it is giving me an error that I can not resolve. This error occurs for any tool i try to use (argsoap, abricate, deeparg, resfinder, amrfinderplus). The command I sent is

argnorm amrfinderplus -i examples/raw/amrfinderplus.ncbi.orfs.tsv -o outputs/raw/amrfinderplus.ncbi.orfs.tsv

and the error I get is

Traceback (most recent call last):
  File "/home/vittoria/anaconda3/envs/argnorm/bin/argnorm", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/vittoria/anaconda3/envs/argnorm/lib/python3.12/site-packages/argnorm/cli.py", line 25, in main
    from .normalize import normalize
  File "/home/vittoria/anaconda3/envs/argnorm/lib/python3.12/site-packages/argnorm/normalize.py", line 1, in <module>
    from .normalizers import ARGSOAPNormalizer, \
  File "/home/vittoria/anaconda3/envs/argnorm/lib/python3.12/site-packages/argnorm/normalizers.py", line 5, in <module>
    from .drug_categorization import confers_resistance_to, drugs_to_drug_classes
  File "/home/vittoria/anaconda3/envs/argnorm/lib/python3.12/site-packages/argnorm/drug_categorization.py", line 1, in <module>
    import pronto
  File "/home/vittoria/anaconda3/envs/argnorm/lib/python3.12/site-packages/pronto/__init__.py", line 12, in <module>
    from .ontology import Ontology
  File "/home/vittoria/anaconda3/envs/argnorm/lib/python3.12/site-packages/pronto/ontology.py", line 28, in <module>
    class Ontology(collections.Mapping):
                   ^^^^^^^^^^^^^^^^^^^
AttributeError: module 'collections' has no attribute 'Mapping'

I am using a conda environment created as described in the installation guide, the specification of the environment are reported here:

name: argnorm
channels:
  - bioconda
  - conda-forge
  - defaults
dependencies:
  - _libgcc_mutex=0.1=conda_forge
  - _openmp_mutex=4.5=2_gnu
  - argnorm=0.2.0=pyh7cba7a3_0
  - bzip2=1.0.8=hd590300_5
  - ca-certificates=2024.2.2=hbcca054_0
  - colorama=0.4.6=pyhd8ed1ab_0
  - exceptiongroup=1.2.0=pyhd8ed1ab_2
  - iniconfig=2.0.0=pyhd8ed1ab_0
  - ld_impl_linux-64=2.40=h41732ed_0
  - libblas=3.9.0=22_linux64_openblas
  - libcblas=3.9.0=22_linux64_openblas
  - libexpat=2.6.2=h59595ed_0
  - libffi=3.4.2=h7f98852_5
  - libgcc-ng=13.2.0=h807b86a_5
  - libgfortran-ng=13.2.0=h69a702a_5
  - libgfortran5=13.2.0=ha4646dd_5
  - libgomp=13.2.0=h807b86a_5
  - liblapack=3.9.0=22_linux64_openblas
  - libnsl=2.0.1=hd590300_0
  - libopenblas=0.3.27=pthreads_h413a1c8_0
  - libsqlite=3.45.2=h2797004_0
  - libstdcxx-ng=13.2.0=h7e041cc_5
  - libuuid=2.38.1=h0b41bf4_0
  - libxcrypt=4.4.36=hd590300_1
  - libzlib=1.2.13=hd590300_5
  - ncurses=6.4.20240210=h59595ed_0
  - numpy=1.26.4=py312heda63a1_0
  - openssl=3.2.1=hd590300_1
  - packaging=24.0=pyhd8ed1ab_0
  - pandas=2.2.1=py312hfb8ada1_0
  - pip=24.0=pyhd8ed1ab_0
  - pluggy=1.4.0=pyhd8ed1ab_0
  - pronto=0.12.2=py_0
  - pytest=8.1.1=pyhd8ed1ab_0
  - python=3.12.2=hab00c5b_0_cpython
  - python-dateutil=2.9.0=pyhd8ed1ab_0
  - python-tzdata=2024.1=pyhd8ed1ab_0
  - python_abi=3.12=4_cp312
  - pytz=2024.1=pyhd8ed1ab_0
  - readline=8.2=h8228510_1
  - setuptools=69.2.0=pyhd8ed1ab_0
  - six=1.16.0=pyh6c4a22f_0
  - tk=8.6.13=noxft_h4845f30_101
  - tomli=2.0.1=pyhd8ed1ab_0
  - tzdata=2024a=h0c530f3_0
  - wheel=0.43.0=pyhd8ed1ab_1
  - xz=5.2.6=h166bdaf_0
prefix: /home/vittoria/anaconda3/envs/argnorm

What am I doing wrong? Can someone help me with this? Thank you

Vedanth-Ramji commented 6 months ago

Hi, this seems to be a bug with our conda installation. pronto=0.12.2 is being installed when using bioconda, while pronto=2.5.6 (the correct version) is downloaded through pip. We are working on the issue right now, but in the meantime, you could install argNorm through pip install argnorm and that should resolve your issue.

Thanks for bringing this issue up! Please let me know if you have any other questions.

VittoriaOssanna commented 6 months ago

Worked! Thank you!

luispedro commented 6 months ago

There is still something wrong because the conda install should have worked, so I'm going to reopen...

sebastianLedzianowski commented 6 months ago

Hello, I probably know the solution to the problem. Could I take care of this?

Vedanth-Ramji commented 6 months ago

Hello @sebastianLedzianowski, please feel free to contribute!

sebastianLedzianowski commented 5 months ago

Hello, I found a partial solution to the problem. The problem is that pronto in the 'conda' interpreter does not have any version, I noticed this when trying to create an argnorm package using 'meta.yaml', so I decided to create a whole conda channel so that all users can use your version of the dependencies. This turned out to be problematic because when creating a new channel 'conda-build .' the 'meta.yaml' file looks for dependencies in available packages in conda on the network, which is naturally available nowhere. So I decided to create a pronto channel to be able to use it when creating your channel, which turned out to be disastrous because 'pronto' has two dependencies that are not available in 'conda'. To sum up, we could have fun for so long and we don't know what the final effect will be. Therefore, the simplest and fastest way is to simply add the information to "README.md" that when installing the package via 'conda', you should also install the package pronto using pip. I checked it myself and with such combinations

conda install bioconda::argnorm
pip install --upgrade pronto

the package works flawlessly. Can I make a mistake by editing the "README.md" file this way?