when run pretrain.py ImportError: cannot import name 'best_partition' from 'community' (/home/anaconda3/envs/CACL/lib/python3.10/site-packages/community/__init__.py) #3
when I run the pretrain.py:python3 pretrain.py --dataset cresci15 --basic_model HGT
it report :
Traceback (most recent call last):
File "/home/bjf/CACL/pretrain.py", line 4, in
from CD_model import ModCDModel
File "/home/bjf/CACL/CD_model.py", line 8, in
from community import best_partition
ImportError: cannot import name 'best_partition' from 'community' (/home/bjf/anaconda3/envs/CACL/lib/python3.10/site-packages/community/init.py)
i try change the version of community to 1.0.0a1/1.0.0a2 ,but the bug still exist。
Because the package name and the module name are different, you can try to use pip install python-louvain instead of pip install community, and use from community import best_partition in the code.
when I run the pretrain.py:python3 pretrain.py --dataset cresci15 --basic_model HGT it report : Traceback (most recent call last): File "/home/bjf/CACL/pretrain.py", line 4, in
from CD_model import ModCDModel
File "/home/bjf/CACL/CD_model.py", line 8, in
from community import best_partition
ImportError: cannot import name 'best_partition' from 'community' (/home/bjf/anaconda3/envs/CACL/lib/python3.10/site-packages/community/init.py)
i try change the version of community to 1.0.0a1/1.0.0a2 ,but the bug still exist。