natapol / kitsune

a toolkit for evaluation of the lenght of k-mer in a given genome dataset for alignment-free phylogenimic analysis.
GNU General Public License v3.0
9 stars 3 forks source link

ModuleNotFoundError: No module named 'kitsune.modules'; 'kitsune' is not a package #13

Open rmormando opened 1 year ago

rmormando commented 1 year ago

Hello I just installed kitsune on my mac from the GitHub source. When I use the help command: python3 kitsune.py --help it outputs the normal message:

usage: kitsune <command> [<args>]

Available commands:
    acf Compute average number of common features between signatures
    cre Compute cumulative relative entropy
    dmatrix Compute distance matrix
    kopt    Compute recommended choice (optimal) of kmer within a given kmer interval for a set of genomes using the cre, acf and ofc
    ofc Compute observed feature frequencies

Use --help in conjunction with one of the commands above for a list of available options (e.g. kitsune acf --help)

However when I do python3 kitsune.py kopt --help I get this message:

Traceback (most recent call last):
  File "/Users/rimo/kitsune/kitsune/kitsune.py", line 75, in <module>
    main()
  File "/Users/rimo/kitsune/kitsune/kitsune.py", line 70, in main
    module = importlib.import_module("kitsune.modules.{}".format(cmd))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1126, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1135, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'kitsune.modules'; 'kitsune' is not a package

This happens when I try to use the kopt command with parameters set and I don't understand what's wrong or how to fix it.

rmormando commented 1 year ago

okay I uninstalled kitsune and then redid the installation using pip install kitsune and after running kitsune kopt -h I get this error message:

Traceback (most recent call last):
  File "/opt/homebrew/bin/kitsune", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/kitsune/kitsune.py", line 70, in main
    module = importlib.import_module("kitsune.modules.{}".format(cmd))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/opt/homebrew/lib/python3.11/site-packages/kitsune/modules/kopt.py", line 23, in <module>
    from kitsune.modules import kitsunejf as jf
  File "/opt/homebrew/lib/python3.11/site-packages/kitsune/modules/kitsunejf.py", line 152, in <module>
    distance.kulsinski,
    ^^^^^^^^^^^^^^^^^^
AttributeError: module 'scipy.spatial.distance' has no attribute 'kulsinski'

I get the normal help message as above when I do kitsune --help but I don't know why this isn't working...

natapol commented 1 year ago

This error is due to the update of SciPy 1.11.0. The kulsinski function was removed. For a quick fix, Please create a Python environment and install SciPy version 11.10.1 or an earlier version then install Kitsune via pip again.

We will update the new version of Kitsune soon.

rmormando commented 1 year ago

I was able to make a python environment with scipy == 1.10.1 and kitsune and I am able to get a help message when I run the command kitsune kopt --help however when I run the kopt command I get a new error message:

Computing Cumulative Relative Entropy (CRE)
  0%|                                                     | 0/6 [00:01<?, ?it/s]
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
  File "/Users/rimo/kitsune_env/lib/python3.11/site-packages/kitsune/modules/kitsunejf.py", line 236, in __init__
    datadict[dat[0]] = int(dat[1])
                       ^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: 'terminating'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
                    ^^^^^^^^^^^^^^^^^^^
  File "/Users/rimo/kitsune_env/lib/python3.11/site-packages/kitsune/modules/kopt.py", line 331, in par_cre
    _, a0 = count_kmers_partial(genome, kmin=kmer, kmax=kmer)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/rimo/kitsune_env/lib/python3.11/site-packages/kitsune/modules/kopt.py", line 167, in count_kmers
    datadict[kmer] = jf.Kmercount(
                     ^^^^^^^^^^^^^
  File "/Users/rimo/kitsune_env/lib/python3.11/site-packages/kitsune/modules/kitsunejf.py", line 239, in __init__
    raise JellyFishError("Bloom filter file is truncated.")
kitsune.modules.kitsunejf.JellyFishError: Bloom filter file is truncated.
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/rimo/kitsune_env/bin/kitsune", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/rimo/kitsune_env/lib/python3.11/site-packages/kitsune/kitsune.py", line 71, in main
    module.run(sys.argv)
  File "/Users/rimo/kitsune_env/lib/python3.11/site-packages/kitsune/modules/kopt.py", line 669, in run
    optimal_kmer_size(
  File "/Users/rimo/kitsune_env/lib/python3.11/site-packages/kitsune/modules/kopt.py", line 587, in optimal_kmer_size
    cre_results.append(job.get())
                       ^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/pool.py", line 774, in get
    raise self._value
kitsune.modules.kitsunejf.JellyFishError: Bloom filter file is truncated.

This is the command I run: kitsune kopt --filenames ./American/american_paths.txt --k-min 10 --k-max 30 --canonical --closely-related --threads 8 --nproc 2 --output ./American/kitsune_out.txt

Any idea what this might mean/how to fix this error?