popgenmethods / momi2

Infer demographic history with the Moran model
GNU General Public License v3.0
47 stars 11 forks source link

Error when computing allele counts #37

Closed deponent-verb closed 4 years ago

deponent-verb commented 4 years ago

Hello,

I am trying to go through the tutorial. When I get to code chunk under "Compute allele counts", I get this error.

/Users/anthony/opt/anaconda3/bin/python: Error while finding module specification for 'momi.read_vcf' (ModuleNotFoundError: No module named 'momi')

I find this really strange as all the earlier chunks have worked. Many of those use momi functions.

I am on Mac OS Catalina (10.15.1).

Cheers.

jackkamm commented 4 years ago

That chunk is evaluated as a separate bash command, and not in the same Python environment as in all the other chunks.

So, you might have to modify the call to python in the bash chunk, to the correct python executable.

Are you executing the notebook in a conda environment? If so, could you try changing python to something like /Users/anthony/opt/anaconda3/envs/momi-env/bin/python (replacing "momi-env" with the actual name of the conda environment)?

deponent-verb commented 4 years ago

Thank you very much. I changed the code chunk to the following and it worked.

%%sh for chrom in seq 1 20; do /Users/anthony/opt/anaconda3/envs/momi-env/bin/python -m momi.read_vcf \ tutorial_datasets/$chrom.vcf.gz tutorial_datasets/ind2pop.txt \ tutorial_datasets/$chrom.snpAlleleCounts.gz \ --bed tutorial_datasets/$chrom.bed done