cbg-ethz/cojac

yaml module not found

Opened this issue · 3 comments

Hello,
I installed cojac using conda within a virtual environment (mac monterey)
conda create -n cojac
conda activate cojac
conda install cojac
but am now encountering the following error when testing:
cooc-mutbamscan --help
Traceback (most recent call last):
File "/Users/susanne/opt/anaconda3/envs/cojac/bin/cooc-mutbamscan", line 10, in
import yaml
ModuleNotFoundError: No module named 'yaml'
I tried to install yaml via conda and pip, as well as homebrew. When I just use python within the cojac environment I can import the module, but I can't appear to solve the error.
Thank you and any help is appreciated,
Susanne

DrYak commented

tried to install yaml via conda

Please note that in conda, the python module is called pyyaml (whereas yaml refers to the C library)

import yaml
ModuleNotFoundError: No module named 'yaml'

This is extremely strange because pyyaml is listed as a hard dependency of cojac, and cooc-mutbamscan --help is part of the quick tests done as part of the conda package self-test.

I can't manage to reproduce:

$ conda install cojac
Collecting package metadata (current_repodata.json): done

The following NEW packages will be INSTALLED:

  cojac              bioconda/noarch::cojac-0.2-hdfd78af_0

  pyyaml             conda-forge/linux-64::pyyaml-6.0-py39h3811e60_3

  ruamel.yaml        conda-forge/linux-64::ruamel.yaml-0.17.21-py39h3811e60_0
  ruamel.yaml.clib   conda-forge/linux-64::ruamel.yaml.clib-0.2.6-py39h3811e60_0

  strictyaml         conda-forge/noarch::strictyaml-1.3.2-pyh44b312d_0

  yaml               conda-forge/linux-64::yaml-0.2.5-h7f98852_2

Proceed ([y]/n)? 

Some questions:

  • Do you also get our latest package version 0.2?
    (Maybe your local cache is out of date? Try using conda clean)
  • Do you get most of your packages from conda-forge, with a few remaining (cojac and pysam) from bioconda?
    (Maybe your channel order isn't set up correctly, try running:
    conda config --add channels defaults
    conda config --add channels bioconda
    conda config --add channels conda-forge
  • What environment are you running in? I presume it's Mac OS X?

    as well as homebrew

  • Which copy of python are you running? try:
    which python3
    python3 --version
    The python3 executable should be in your conda environment, e.g. …/miniconda3/envs/cojac/bin/python3, and nowadays conda should have installed python 3.9 or 3.10. It's possible that your current python installation has become somewhat messy and the wrong environment or version is being loaded.
DrYak commented

Another possible 1-liner you could run to try to debug:

python3 -c 'import sys; print("\n".join(sys.path))'

All the displayed search paths should all point within the conda environment (…/miniconda3/envs/cojac/lib/python…). None of them should point to you other python environment (to homebrew, etc.)

Lastly, the …/miniconda3/envs/cojac/lib/pythonx.y/site-packages directory listed before should contain a module called yaml.