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

Population must be a sequence #280

Closed
yl030 opened this issue Sep 5, 2024 · 3 comments
Closed

Population must be a sequence #280

yl030 opened this issue Sep 5, 2024 · 3 comments
Labels

Comments

@yl030
Copy link

yl030 commented Sep 5, 2024

Hello ppanggolin team,
I installed ppanggolin through conda and when I run % ppanggolin all --fasta genomes.fasta.list

Traceback (most recent call last):
  File "/gss1/home/home/.conda/envs/ppanggolin211/bin/ppanggolin", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/gss1/home/home/.conda/envs/ppanggolin211/lib/python3.12/site-packages/ppanggolin/main.py", line 221, in main
    ppanggolin.workflow.all.launch(args)
  File "/gss1/home/home/.conda/envs/ppanggolin211/lib/python3.12/site-packages/ppanggolin/workflow/all.py", line 294, in launch
    launch_workflow(args, panrgp=True, panmodule=True)
  File "/gss1/home/home/.conda/envs/ppanggolin211/lib/python3.12/site-packages/ppanggolin/workflow/all.py", line 124, in launch_workflow
    partition(pangenome,
  File "/gss1/home/home/.conda/envs/ppanggolin211/lib/python3.12/site-packages/ppanggolin/nem/partition.py", line 489, in partition
    kval = evaluate_nb_partitions(organisms, output, sm_degree, free_dispersion, chunk_size, kmm,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/gss1/home/home/.conda/envs/ppanggolin211/lib/python3.12/site-packages/ppanggolin/nem/partition.py", line 324, in evaluate_nb_partitions
    select_organisms = set(random.sample(set(organisms), chunk_size))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/gss1/home/home/.conda/envs/ppanggolin211/lib/python3.12/random.py", line 413, in sample
    raise TypeError("Population must be a sequence.  "
TypeError: Population must be a sequence.  For dicts or sets, use sorted(d).
@JeanMainguy
Copy link
Member

Hi,
Thanks for reporting the issue!
This is a known problem related to Python 3.12 compatibility. It's the same error as in issue #268, and it has been addressed in PR #273, which will be released soon.
In the meantime, you can either use an earlier version of Python or try the fix from the support_py3.12 branch. To do that, simply clone the repo and install it in your conda environment:

conda activate ppanggolin211
git clone --branch support_py3.12 https://github.com/labgem/PPanGGOLiN.git
cd PPanGGOLiN
pip install .

@JeanMainguy JeanMainguy added the bug label Sep 5, 2024
@yl030
Copy link
Author

yl030 commented Sep 6, 2024

Thank you

@JeanMainguy
Copy link
Member

Hi,
The fix has been released in version 2.1.2.
PPanGGOLIN should now work fine with Python 3.12.

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

2 participants