Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sourmash failed to run with Python 3.7. #2820

Closed
shenwei356 opened this issue Oct 21, 2023 · 6 comments
Closed

Sourmash failed to run with Python 3.7. #2820

shenwei356 opened this issue Oct 21, 2023 · 6 comments

Comments

@shenwei356
Copy link

shenwei356 commented Oct 21, 2023

Hi, good weekend!

sourmash runs under Python 3.7 and later. The base requirements are screed, cffi, numpy, matplotlib, and scipy. Conda (see below) will install everything necessary, and is our recommended installation method.

I just tried Python 3.7, but there's an error reporting that importlib-metadata is missing.

ModuleNotFoundError: No module named 'importlib.metadata'

So the minimum Python version might be 3.8.

Besides, it would better to add screed, cffi, numpy, matplotlib, and scipy as dependencies in bioconda-recipe meta file.

@luizirber
Copy link
Member

sourmash runs under Python 3.7 and later. The base requirements are screed, cffi, numpy, matplotlib, and scipy. Conda (see below) will install everything necessary, and is our recommended installation method.

Yup, we should update docs, it should be 3.8 (and we should even be close to dropping 3.9, since we follow https://scientific-python.org/specs/spec-0000/)

ref: #2288

Besides, it would better to add screed, cffi, numpy, matplotlib, and scipy as dependencies in bioconda-recipe meta file.

Not quite. The only dep in bioconda is sourmash-minimal from https://github.com/conda-forge/sourmash-minimal-feedstock, where we specify all deps. The bioconda package is mostly an alias to the minimal one, so we still have biocontainers being built.

@luizirber
Copy link
Member

We dropped 3.8 from sourmash-minimal too, so definitely should be 3.9 =]

@shenwei356
Copy link
Author

Not quite. The only dep in bioconda is sourmash-minimal from https://github.com/conda-forge/sourmash-minimal-feedstock, where we specify all deps. The bioconda package is mostly an alias to the minimal one, so we still have biocontainers being built.

Really? That day, I freshly installed sourmash with Python3.9, but failed to run the plot functions, which complained the missing packages and I had to install them manually.

@luizirber
Copy link
Member

luizirber commented Oct 23, 2023

Trying to reproduce:


Starting from an empty container with

docker run -v $(pwd):/data -it ubuntu /bin/bash

Installing miniforge:

apt update  && apt install curl
curl -JLO https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh
bash Miniforge3-Linux-x86_64.sh  
source /root/.bashrc 

create an env for sourmash (defaulted to 3.12):

conda create -n sourmash -c conda-forge -c bioconda sourmash 
conda activate sourmash
sourmash compare -k21 -o dist sequence.fasta.sig sequence.fasta.sig
sourmash plot dist 

Forcing Python 3.9:

conda create -n sourmash_39 -c conda-forge -c bioconda sourmash python=3.9
conda activate sourmash_39
sourmash compare -k21 -o dist sequence.fasta.sig sequence.fasta.sig
sourmash plot dist 

Both 3.12 and 3.9 worked (tho with very boring plots =P).

Are you running this on Linux or MacOS?

@shenwei356
Copy link
Author

Well, I can't reproduce it now -_-!

$ uname -a
Linux mBio 5.15.133-1-MANJARO #1 SMP PREEMPT Sat Sep 23 10:10:02 UTC 2023 x86_64 GNU/Linux

$ mamba --version
mamba 0.27.0
conda 22.11.1

$ cat .condarc
channels:
  - conda-forge
  - bioconda
  - defaults
channel_priority: strict

$ mamba create -n smash python==3.9

$ mamba install sourmash

  + sourmash                 4.8.4  hdfd78af_0           bioconda/noarch             8kB
  + sourmash-minimal         4.8.4  py39h9fdd4d6_1       conda-forge/linux-64        8MB

$ sourmash sketch dna -p k=31 t.fa -o t.sig

$ sourmash compare -k31 -o dist t.sig  t.sig

$ sourmash plot --pdf --labels dist \
        --labeltext dist.labels.txt \
        --csv dist.csv
        

Another interesting thing is that when I specify the channel by -c bioconda, it tried to install an older version of sourmash.

$ mamba install -c bioconda sourmash
Looking for: ['sourmash']

bioconda/linux-64                                           Using cache
bioconda/noarch                                             Using cache
conda-forge/linux-64                                        Using cache
conda-forge/noarch                                          Using cache
pkgs/r/noarch                                                 No change
pkgs/main/noarch                                              No change
pkgs/r/linux-64                                               No change
pkgs/main/linux-64                                            No change

Pinned packages:
  - python 3.9.*


Encountered problems while solving:
  - package sourmash-3.5.0-0 requires bam2fasta >=1.0.1, but none of the providers can be installed

@luizirber
Copy link
Member

Well, I can't reproduce it now -_-!

Thanks for checking! Bummer that we can't find it issue again =/

I'll change the conda-forge and bioconda recipes to do a small test for all commands (so at least it can check if a dep is missing), similar to what we both tried.

Another interesting thing is that when I specify the channel by -c bioconda, it tried to install an older version of sourmash.

Encountered problems while solving:
  - package sourmash-3.5.0-0 requires bam2fasta >=1.0.1, but none of the providers can be installed

Somewhat expected: since sourmash-minimal is in conda-forge, if specifying only bioconda it will try to find the oldest sourmash that was bioconda-only (hence 3.5.0).

If you want to skip bioconda completely, you can do

mamba install -c conda-forge sourmash-minimal

for similar results =]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants