open2c / quaich

snakemake pipeline for Hi-C post-processing
MIT License
22 stars 6 forks source link

cooltools wrapper import error #13

Closed shappiron closed 1 year ago

shappiron commented 1 year ago

Hi! I faced a problem after installing the workflow with mamba (but probably it is not the problem). And after running the pipeline got the following error on make_expected_cis step:

INFO:snakemake.logging:[Sun Mar  5 11:22:34 2023]
rule make_expected_cis:
    input: inputs/coolers/O2.mcool, resources/view.txt
    output: results/expected/O2_100000.expected.tsv
    jobid: 14
    reason: Missing output files: results/expected/O2_100000.expected.tsv
    wildcards: sample=O2, resolution=100000
    threads: 4
    resources: tmpdir=/tmp, mem_mb=32768, mem_mib=31250, runtime=60
INFO:snakemake.logging:rule make_expected_cis:
    input: inputs/coolers/O2.mcool, resources/view.txt
    output: results/expected/O2_100000.expected.tsv
    jobid: 14
    reason: Missing output files: results/expected/O2_100000.expected.tsv
    wildcards: sample=O2, resolution=100000
    threads: 4
    resources: tmpdir=/tmp, mem_mb=32768, mem_mib=31250, runtime=60
`
INFO:snakemake.logging:
Activating conda environment: .snakemake/conda/8771711dc4cd22b0e83a4f95250c3973_
WARNING:snakemake.logging:Activating conda environment: .snakemake/conda/8771711dc4cd22b0e83a4f95250c3973_
Activating conda environment: .snakemake/conda/8771711dc4cd22b0e83a4f95250c3973_
WARNING:snakemake.logging:Activating conda environment: .snakemake/conda/8771711dc4cd22b0e83a4f95250c3973_
Traceback (most recent call last):
  File "/home/dkriukov/quaich_aging/.snakemake/conda/8771711dc4cd22b0e83a4f95250c3973_/bin/cooltools", line 7, in <module>
    from cooltools.cli import cli
  File "/home/dkriukov/quaich_aging/.snakemake/conda/8771711dc4cd22b0e83a4f95250c3973_/lib/python3.9/site-packages/cooltools/__init__.py", line 18, in <module>
    from .lib import (
  File "/home/dkriukov/quaich_aging/.snakemake/conda/8771711dc4cd22b0e83a4f95250c3973_/lib/python3.9/site-packages/cooltools/lib/numutils.py", line 7, in <module>
    import numba
  File "/home/dkriukov/quaich_aging/.snakemake/conda/8771711dc4cd22b0e83a4f95250c3973_/lib/python3.9/site-packages/numba/__init__.py", line 43, in <module>
    from numba.np.ufunc import (vectorize, guvectorize, threading_layer,
  File "/home/dkriukov/quaich_aging/.snakemake/conda/8771711dc4cd22b0e83a4f95250c3973_/lib/python3.9/site-packages/numba/np/ufunc/__init__.py", line 3, in <module>
    from numba.np.ufunc.decorators import Vectorize, GUVectorize, vectorize, guvectorize
  File "/home/dkriukov/quaich_aging/.snakemake/conda/8771711dc4cd22b0e83a4f95250c3973_/lib/python3.9/site-packages/numba/np/ufunc/decorators.py", line 3, in <module>
    from numba.np.ufunc import _internal
SystemError: initialization of _internal failed without raising an exception
Traceback (most recent call last):
  File "/home/dkriukov/quaich_aging/.snakemake/scripts/tmpq0j_5pp0.wrapper.py", line 26, in <module>
    shell(
  File "/home/dkriukov/miniconda3/envs/quaich/lib/python3.10/site-packages/snakemake/shell.py", line 300, in __new__
    raise sp.CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'set -euo pipefail;  (cooltools expected-cis inputs/coolers/O2.mcool::resolutions/100000  --view resources/view.txt  --ignore-diags 0  -p 4  -o results/expected/O2_100000.expected.tsv)' returned non-zero exit status 1.
[Sun Mar  5 11:22:36 2023]
INFO:snakemake.logging:[Sun Mar  5 11:22:36 2023]
Error in rule make_expected_cis:
    jobid: 14
    input: inputs/coolers/O2.mcool, resources/view.txt
    output: results/expected/O2_100000.expected.tsv
    conda-env: /home/dkriukov/quaich_aging/.snakemake/conda/8771711dc4cd22b0e83a4f95250c3973_

ERROR:snakemake.logging:Error in rule make_expected_cis:
    jobid: 14
    input: inputs/coolers/O2.mcool, resources/view.txt
    output: results/expected/O2_100000.expected.tsv
    conda-env: /home/dkriukov/quaich_aging/.snakemake/conda/8771711dc4cd22b0e83a4f95250c3973_

Shutting down, this might take some time.
WARNING:snakemake.logging:Shutting down, this might take some time.
Exiting because a job execution failed. Look above for error message
ERROR:snakemake.logging:Exiting because a job execution failed. Look above for error message
Complete log: .snakemake/log/2023-03-05T112226.404875.snakemake.log
WARNING:snakemake.logging:Complete log: .snakemake/log/2023-03-05T112226.404875.snakemake.log

I must note that this problem is not in the actual version of the repository, but in my fork. Meanwhile, I decided to write the issue here because I didn't make any changes in the actual cooltools wrapper which does perform this rule. Moreover, when I run my fork locally everything is well but after reinstallation, on the remote machine, the error above appears.

Could you help me with any advice, please?

Phlya commented 1 year ago

Can you check which version of numpy you got in the conda environment for that wrapper? I've seen this problem because of https://github.com/numba/numba/issues/8615, but the version of numpy is pinned in the cooltools bioconda recipe to avoid it...

shappiron commented 1 year ago

numpy='1.24.2'

Interestingly, on local machine I have numpy='1.23.5'. Apparently I can downgrade it by putting the actual version into the .yaml file. But is there better option?

Phlya commented 1 year ago

I don't know how it is possible for you to get that version, since it's pinned <1.2... So just try downgrading like that I guess.

shappiron commented 1 year ago

I noted the difference between two yaml files:

Working case:

channels:
  - conda-forge
  - defaults
  - bioconda
dependencies:
  - ucsc-bedgraphtobigwig
  - cooltools =0.5.2

Case returning error

channels:
  - conda-forge
  - defaults
  - bioconda
dependencies:
  - cooltools =0.5.1

Are these yaml files depend on the version of wrapper?

Phlya commented 1 year ago

Wait, why do you have different yaml files? I assumed you were using latest versions in both cases...

shappiron commented 1 year ago

As I mentioned previously I forked your repository some time ago. But my fork still depends on snakemake-wrappers which I fetch from here (I guess). I can't understand how to control versions of wrappers I fetch.

Phlya commented 1 year ago

Just fetch the latest wrappers, or at least the version that is mentioned in the rules in the master branch here. E.g.

    wrapper:
        "v1.21.2/bio/cooltools/expected_cis"
shappiron commented 1 year ago

This is the core of my problem. I put v1.19.1 in both cases (working and not working) and it doesn't affect yaml file. Moreover, when I put 1.21.2 - nothing changes.

Phlya commented 1 year ago

Idk perhaps delete the .snakemake folder?.. I've never had this problem.

shappiron commented 1 year ago

Do I correctly get that "...it's pinned <1.2..." means that numpy should have the corresponding version restriction in this file. If yes, it doesn't have actually.

shappiron commented 1 year ago

Finally, I found a problem. I forgot to enter the command conda config --set channel_priority strict as workflow recommends at the start. I propose to add this small line to the README in the future.

Thank you for your advice!

Phlya commented 1 year ago

I see! Great that you solved it, thanks for letting me know what helped!