AttributeError: module 'gensim.models.keyedvectors' has no attribute 'BaseKeyedVectors'

537 views
Skip to first unread message

santosh.b...@gmail.com

unread,
Dec 20, 2020, 6:52:29 AM12/20/20
to Gensim
After installing Genim 4.0 beta, I get the below error for a few Python packages such as wefe (https://github.com/dccuchile/wefe )and responsibly (https://github.com/ResponsiblyAI/responsibly) that uses Gensim:

AttributeError: module 'gensim.models.keyedvectors' has no attribute 'BaseKeyedVectors' 

Is there a fix for this issue?

Thanks,
sbs

Gordon Mohr

unread,
Dec 21, 2020, 5:03:52 PM12/21/20
to Gensim
In general, third-party libraries that build on Gensim, if they used properties/methods that have changed, need to update their code - so you should file Github issues with these projects requesting that. (I see that for WEFE, one is already filed/in-progress: <https://github.com/dccuchile/wefe/issues/9>)

In most cases the changes should be pretty simple, and the Gensim 3-to-4 migration guide has an overview of the main things these package authors will need to change:

An error like the one you've mentioned, regarding a removed abstract class (`BaseKeyedVectors`), may require a bit more attention to remedy depending on the specifics of their usage/extension. (But it's also possible that the new, concrete `KeyedVectors` class will serve the need directly as a drop-in replacement.)

Before any source code changes are completed, the quickie workaround for either users or these libraries' authors would be to stay on `gensim-3.8.3`. (The package authors could specify this in their declared dependencies even before they update Python code – and after they update their Python code, they can specify that Gensim 4+ is now required.)

- Gordon

santosh.b...@gmail.com

unread,
Dec 31, 2020, 3:49:53 AM12/31/20
to Gensim
Thanks a lot, Gordon.
Reply all
Reply to author
Forward
0 new messages