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

Flye install fails with Python 3.12 #669

Open
pushkarnk opened this issue Feb 3, 2024 · 6 comments
Open

Flye install fails with Python 3.12 #669

pushkarnk opened this issue Feb 3, 2024 · 6 comments
Labels

Comments

@pushkarnk
Copy link
Contributor

With Python 3.12 installed on the Ubuntu dev release, when I tried to make, install and run the install test, the test fails with :

python3 flye/tests/test_toy.py
Running toy test:

Traceback (most recent call last):
  File "/usr/local/bin/flye", line 33, in <module>
    sys.exit(load_entry_point('flye==2.9.3', 'console_scripts', 'flye')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/bin/flye", line 25, in importlib_load_entry_point
    return next(matches).load()
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/importlib/metadata/__init__.py", line 205, in load
    module = import_module(match.group('module'))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 994, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/usr/local/lib/python3.12/dist-packages/flye/main.py", line 19, in <module>
    import flye.polishing.alignment as aln
  File "/usr/local/lib/python3.12/dist-packages/flye/polishing/alignment.py", line 18, in <module>
    import flye.utils.fasta_parser as fp
  File "/usr/local/lib/python3.12/dist-packages/flye/utils/fasta_parser.py", line 26, in <module>
    from flye.six.moves import range
ModuleNotFoundError: No module named 'flye.six.moves'
Traceback (most recent call last):
  File "/root/Flye/flye/tests/test_toy.py", line 41, in <module>
    sys.exit(main())
             ^^^^^^
  File "/root/Flye/flye/tests/test_toy.py", line 36, in main
    test_toy()
  File "/root/Flye/flye/tests/test_toy.py", line 29, in test_toy
    subprocess.check_call(["flye", "--pacbio-corr", reads_file, "-g", "500k",
  File "/usr/lib/python3.12/subprocess.py", line 413, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['flye', '--pacbio-corr', '/root/Flye/flye/tests/data/ecoli_500kb_reads_hifi.fastq.gz', '-g', '500k', '-o', 'flye_toy_test', '-t', '8', '-m', '1000']' returned non-zero exit status 1.

In short, Python 3.12 fails to find the "moves" module which is dynamically loaded using flye/six.py. This is likely to be because Python3 has gradually moved away from find_module() to find_spec() for path-based finders searching the meta path:

Changed in version 3.4: The [find_spec()](https://docs.python.org/3/library/importlib.html#importlib.abc.MetaPathFinder.find_spec) method of meta path finders replaced find_module(), which is now deprecated. While it will continue to work without change, the import machinery will try it only if the finder does not implement [find_spec()](https://docs.python.org/3/library/importlib.html#importlib.abc.MetaPathFinder.find_spec).

Changed in version 3.10: Use of find_module() by the import system now raises [ImportWarning](https://docs.python.org/3/library/exceptions.html#ImportWarning).

Changed in version 3.12: find_module() has been removed. Use [find_spec()](https://docs.python.org/3/library/importlib.html#importlib.abc.MetaPathFinder.find_spec) instead.

flye/six.py hasn't yet moved from find_module() to find_spec() and this is likely to be the reason for the above error.

@pushkarnk
Copy link
Contributor Author

Fix proposed via #670

@mikolmogorov
Copy link
Owner

Thanks, will work on that in the next release.

@a-detiste
Copy link

six should be removed too

@mikolmogorov
Copy link
Owner

Version 2.9.5 now supports Python 3.12. six is not removed yet, but will be in the next release.

@tnn111
Copy link

tnn111 commented Aug 27, 2024 via email

@shaze
Copy link

shaze commented Aug 28, 2024

@mikolmogorov Thanks -- much appreciated -- fixed for me Python 3.12 under Rocky 9.

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

No branches or pull requests

5 participants