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 not installing in binder: "No module named 'importlib.metadata'" error #2503

Open
hehouts opened this issue Mar 4, 2023 · 10 comments

Comments

@hehouts
Copy link
Contributor

hehouts commented Mar 4, 2023

Hello!

I am trying to set up a binder using sourmash, and I am getting the following error:

Traceback (most recent call last):
  File "/srv/conda/envs/notebook/bin/sourmash", line 7, in <module>
    from sourmash.__main__ import main
  File "/srv/conda/envs/notebook/lib/python3.7/site-packages/sourmash/__init__.py", line 113, in <module>
    from . import lca
  File "/srv/conda/envs/notebook/lib/python3.7/site-packages/sourmash/lca/__init__.py", line 8, in <module>
    from .command_index import index
  File "/srv/conda/envs/notebook/lib/python3.7/site-packages/sourmash/lca/command_index.py", line 9, in <module>
    from sourmash import sourmash_args
  File "/srv/conda/envs/notebook/lib/python3.7/site-packages/sourmash/sourmash_args.py", line 46, in <module>
    import screed
  File "/srv/conda/envs/notebook/lib/python3.7/site-packages/screed/__init__.py", line 39, in <module>
    from importlib.metadata import version, PackageNotFoundError
ModuleNotFoundError: No module named 'importlib.metadata'

if I run pip show sourmash in the binder terminal, I get

Name: sourmash
Version: 4.3.0
Summary: tools for comparing DNA sequences with MinHash sketches
Home-page: https://github.com/dib-lab/sourmash
Author: Luiz Irber, Harriet Alexander, Olga Botvinnik, Phillip Brooks, Laurent Gautier, Tim Head, Lisa K. Johnson, Fabian Klötzl, Katrin Leinweber, Ivan Ogasawara, N. Tessa Pierce, Taylor Reiter, Andreas Sjödin, Connor T. Skennerton, Daniel Standage, S. Joshua Swamidass, Connor Tiffany, Erik Young, C. Titus Brown
Author-email: titus@idyll.org
License: BSD 3-clause
Location: /srv/conda/envs/notebook/lib/python3.7/site-packages
Requires: cachetools, cffi, deprecation, matplotlib, numpy, scipy, screed
Required-by:

cc: @luizirber , @ctb

@hehouts
Copy link
Contributor Author

hehouts commented Mar 4, 2023

This is the binder repo, I will not make any changes until its safe :D
https://github.com/hehouts/lab14_binder

this is the binder launch link Ive been using: https://mybinder.org/v2/gh/hehouts/lab14_binder.git/HEAD/?urlpath=rstudio

@ctb
Copy link
Contributor

ctb commented Mar 4, 2023

some oddities 😁

/srv/conda/envs/notebook/bin/ is put in the PATH regardless of what conda environment you're in.

`/srv/conda/envs/notebook/bin/python -V' is Python 3.7.12

default Python in base environment is /srv/conda/bin/python, /srv/conda/bin/python -V shows Python 3.10.9.

yay.

@sapuizait
Copy link

HI there - i have the same error when trying to install in on a SLURM cluster using conda

(sourmash) [XXX@hpclogin01 ~]$ pip show sourmash
Name: sourmash
Version: 3.3.0
Summary: tools for comparing DNA sequences with MinHash sketches
Home-page: https://github.com/dib-lab/sourmash
Author: C. Titus Brown
Author-email: titus@idyll.org
License: BSD 3-clause
Location: /home/XXX/miniconda3/envs/sourmash/lib/python3.7/site-packages
Requires: cffi, deprecation, matplotlib, numpy, scipy, screed
Required-by

so... is there a solution?

@ctb
Copy link
Contributor

ctb commented Mar 5, 2023

yep - looks like the solution is to make sure that python >= 3.8. As you can see @sapuizait yours is python 3.7 -

Location: /home/XXX/miniconda3/envs/sourmash/lib/python3.7/site-packages

let us know if that works!

@sapuizait
Copy link

yay! seems to be working!

@luizirber
Copy link
Member

Food for thought: should we change the conda install instructions from
conda install -c conda-forge -c bioconda sourmash
to
conda install -c conda-forge sourmash-minimal?

We sort of kept the bioconda package because it generates biocontainers, but otherwise it ends up causing compatibility problems if bioconda is not set up in the recommended way...

(or, more extremely, we could rename sourmash-minimal to sourmash in conda-forge and explicitly depend on conda-forge::sourmash in the bioconda recipe, but I think that might be too much confusion...)

@fabianegli
Copy link

This is a symptom of not specifying the version of sourmash you want to install. Newer versions are not compatible with Python 3.7 which means the installer looks for previous versions which are compatible and they find sourmash version 3.3.0. And this release is apparently buggy.

A solution would be to specify a recent version of sourmash in the docs. e.g.

conda install -c conda-forge -c bioconda sourmash=4.7.0

This will tell the user that is not possible to resolve the dependencies if it is run in a conda environment using Python versions < 3.8

@ctb
Copy link
Contributor

ctb commented Apr 9, 2023

This is a symptom of not specifying the version of sourmash you want to install. Newer versions are not compatible with Python 3.7 which means the installer looks for previous versions which are compatible and they find sourmash version 3.3.0. And this release is apparently buggy.

right, two issues here -

  • why is sourmash failing with that error message...!
  • why are binders defaulting to python 3.7!

A solution would be to specify a recent version of sourmash in the docs. e.g.

conda install -c conda-forge -c bioconda sourmash=4.7.0

This will tell the user that is not possible to resolve the dependencies if it is run in a conda environment using Python versions < 3.8

yep. I'd like to avoid having sourmash version numbers hardcoded in the docs too much, because we always forget to update them, but it might also be something we can put into the release procedure.

@fabianegli
Copy link

I am not sure if this would have the desired effect, but you could try and release a new build restricintg the Python versions for older versions of sourmash. See: https://conda-forge.org/docs/maintainer/updating_pkgs.html#updating-recipes

@ctb
Copy link
Contributor

ctb commented Apr 24, 2023

our default binder/environment.yml in the sourmash repo installs python 3.10 and sourmash 4.8.2 without any version spec, so that's good, I think. not sure if binder updated the default python version or what.

(you can run binder from here, for example)

ctb added a commit that referenced this issue Jun 22, 2023
Fixes #2604

This PR fixes links to binder tutorials that apparently have been broken
since 2020 😱 , when the docs were switched over to myst-parser in
#1021.

To be fair, it's the kind of subtle bug that would leave users
scratching their head going "maybe it's me?" - the links simply went
back to the tutorial page... not sure why they weren't flagged by sphinx
or myst-parser as being bad!?

This PR also updates environment.yml to properly build:
* includes pip
* specifies minimum python version
* specifies minimum sourmash version

ref #2503 for why
specifying the minimum sourmash and/or python versions can be important!

And, finally, I ran and fixed all the notebooks...

Note: I confirmed that this branch launches properly in binder. The URL
is: https://mybinder.org/v2/gh/sourmash-bio/sourmash/fix/tutorial-nb

---------

Co-authored-by: ccbaumler <63077899+ccbaumler@users.noreply.github.com>
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

5 participants