简体   繁体   English

运行gensim分布式LSI时AttributeError模块'Pyro4'没有属性'expose'

[英]AttributeError module 'Pyro4' has no attribute 'expose' while running gensim distributed LSI

So I am trying to run the demo from gensim for distributed LSI (You can find it here ) Yet whenever I run the code I get the error 因此,我尝试从gensim运行针对分布式LSI的演示(您可以在此处找到),但是每当我运行代码时,我都会收到错误消息

AttributeError: module 'Pyro4' has no attribute 'expose'

I have checked similar issues here on stackoverflow, and usually they are caused through misuse of the library. 我在这里检查了关于stackoverflow的类似问题,通常是由于滥用库引起的。

However I am not using Pyro4 directly, I am using Distributed LSI introduced by gensim. 但是我不是直接使用Pyro4,而是使用gensim推出的Distributed LSI。 So there is no room for mistakes on my side (or so I believe) 因此,在我这边没有错误的余地(或者我相信)

My code is really simple you can find it below 我的代码非常简单,您可以在下面找到

from gensim import corpora, models, utils
import logging, os, Pyro4
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
os.environ["PYRO_SERIALIZERS_ACCEPTED"] =  'pickle'
os.environ["PYRO_SERIALIZER"] = 'pickle'

corpus = corpora.MmCorpus('wiki_corpus.mm') # load a corpus of nine documents, from the Tutorials
id2word = corpora.Dictionary.load('wiki_dict.dict')

lsi = models.LsiModel(corpus, id2word=id2word, num_topics=200, chunksize=1, distributed=True) # run distributed LSA on nine documents

Pyro4.expose was added in Pyro4 version 4.27 from august 2014. It looks to me that you have a very old Pyro4 version installed from before this date, and that your gensim requires a more recent one. Pyro4.expose是从2014年8月起在Pyro4版本4.27中添加的。在我看来,您在此日期之前安装了一个非常旧的Pyro4版本,并且您的gensim版本需要更新。

Check using: 检查使用:

$ python -m Pyro4.configuration | head -3

You should probably upgrade your Pyro4 library... Pay attention though, I believe gensim doesn't support the most recent versions of Pyro4 so you should probably check its manual for the correct version that you need. 您可能应该升级您的Pyro4库...不过请注意,我相信gensim不支持Pyro4的最新版本,因此您应该检查其手册以获取所需的正确版本。 You can always try to install the latest (4.61 right now) and see how it goes. 您始终可以尝试安装最新版本(现在为4.61),并查看其运行状况。

edit I suppose you could also try to find gensim specific support? 编辑我想您也可以尝试找到gensim特定的支持吗? https://radimrehurek.com/gensim/support.html https://radimrehurek.com/gensim/support.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM