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

gensim.keyedvectors should be gensim.models.keyedvectors #1455

Closed
ProbonoBonobo opened this issue Jun 29, 2017 · 5 comments
Closed

gensim.keyedvectors should be gensim.models.keyedvectors #1455

ProbonoBonobo opened this issue Jun 29, 2017 · 5 comments

Comments

@ProbonoBonobo
Copy link

Description

From the documentation page at https://radimrehurek.com/gensim/models/keyedvectors.html:

from gensim.keyedvectors import KeyedVectors

Has there been an API change? In my version of gensim KeyedVectors is located in the gensim.models.keyedvectors module.

Steps/Code/Corpus to Reproduce

>>> from gensim.keyedvectors import KeyedVectors

Expected Results

(imports the KeyedVectors class)

Actual Results

Traceback (most recent call last): File "<stdin>", line 1, in <module> ModuleNotFoundError: No module named 'gensim.keyedvectors'

@chinmayapancholi13
Copy link
Contributor

@ProbonoBonobo Hi! You are correct about the API. It should be from gensim.models.keyedvectors import KeyedVectors. There was a correction made for a similar mistake in the docstrings in the code in PR #1337 but I didn't know about the same mistake being there in the html docs as well. Thanks for pointing this out. :) I'll try to update this right away to avoid confusion in the future.

@ProbonoBonobo
Copy link
Author

No worries! Just for my own sanity, is it really the case that KeyedVectors is available in Python3 only? My first thought when I saw the error in a py2.7 anaconda environment was that maybe my gensim version was out of date. So I ran pip install gensim -U in the environment and it updated some stuff, but I still don't see KeyedVectors in gensim.model. I switched to a Python3 environment and voila, there it is. (It's no issue for me if python2.7 isn't forward compatible with it for whatever reason, I just haven't seen any stickynotes that say this, so now I'm wondering if running pip install -U in a conda environment really behaves the way I thought it does.)

@chinmayapancholi13
Copy link
Contributor

No, that's not the case. gensim.models.keyedvectors (infact every Gensim model) is available for Python 2.7 too.
Are you sure you have stuff like Gensim installation, setting env variables etc setup corrrectly? Also, could you share the code snippet and the error that you are getting here so that it's easier to spot the mistake?

@piskvorky
Copy link
Owner

@ProbonoBonobo @chinmayapancholi13 has this issue been fixed by the last release?

@menshikh-iv
Copy link
Contributor

Fixed

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

4 participants