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

HarvestText 安装出现以下问题AttributeError: module 'gensim' has no attribute 'utils' #31

Closed
qq260612718 opened this issue Mar 7, 2021 · 2 comments

Comments

@qq260612718
Copy link

我已经仔细查看过本库的README和之前的Issues,没有发现解决方案。

问题描述
安装出现以下问题

AttributeError Traceback (most recent call last)
in ()
----> 1 from harvesttext import HarvestText
2 ht = HarvestText()

D:\python\lib\site-packages\harvesttext_init_.py in ()
2 #!/usr/bin/env python
3 import pickle
----> 4 from .harvesttext import HarvestText
5 from .resources import *
6

D:\python\lib\site-packages\harvesttext\harvesttext.py in ()
21 from .sentiment import SentimentMixin
22 from .summary import SummaryMixin
---> 23 from .word_discover import WordDiscoverMixin
24 from .resources import get_baidu_stopwords
25

D:\python\lib\site-packages\harvesttext\word_discover.py in ()
9 from .resources import get_baidu_stopwords
10 from .algorithms.word_discoverer import WordDiscoverer
---> 11 from .algorithms.entity_discoverer import NFLEntityDiscoverer, NERPEntityDiscover
12 from .algorithms.keyword import textrank
13

D:\python\lib\site-packages\harvesttext\algorithms\entity_discoverer.py in ()
9 from collections import defaultdict
10 from sklearn.metrics.pairwise import cosine_similarity
---> 11 from gensim.models import FastText
12
13 class NERPEntityDiscover:

D:\python\lib\site-packages\gensim_init_.py in ()
3 """
4
----> 5 from gensim import parsing, corpora, matutils, interfaces, models, similarities, summarization, utils # noqa:F401
6 import logging
7

D:\python\lib\site-packages\gensim\models_init_.py in ()
20 from .atmodel import AuthorTopicModel # noqa:F401
21 from .ldaseqmodel import LdaSeqModel # noqa:F401
---> 22 from .fasttext import FastText # noqa:F401
23 from .translation_matrix import TranslationMatrix, BackMappingTranslationMatrix # noqa:F401
24

D:\python\lib\site-packages\gensim\models\fasttext.py in ()
322
323
--> 324 class FastText(BaseWordEmbeddingsModel):
325 """Train, use and evaluate word representations learned using the method
326 described in Enriching Word Vectors with Subword Information <https://arxiv.org/abs/1607.04606>_, aka FastText.

D:\python\lib\site-packages\gensim\models\fasttext.py in FastText()
494
495 @Property
--> 496 @gensim.utils.deprecated("Attribute will be removed in 4.0.0, use wv.min_n instead")
497 def min_n(self):
498 return self.wv.min_n

AttributeError: module 'gensim' has no attribute 'utils'

操作系统:
win10
python版本:3.7
HarvestText版本:0.8.1.1
genism版本:3.8.3

请问下这个如何解决?

@blmoistawinde
Copy link
Owner

看起来错误是gensim里面发生的,我这边复现不了这个问题。但是因为gensim 3.8.3其实是有utils的,所以怀疑可能你的电脑上装过多个版本的gensim或者不同环境下的gensim有冲突才会出这个问题。建议尝试一下把环境里的gensim清理干净再重装试试,比如:

pip uninstall gensim
pip uninstall gensim
pip install gensim==3.8.3

这边两次uninstall的用意是看一看有没有安装多版本的情况。

@qq260612718
Copy link
Author

好的,非常感谢

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

2 participants