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

train_lda_model() fails to access gensim #90

Open
LeonardWilleke opened this issue Mar 13, 2024 · 4 comments
Open

train_lda_model() fails to access gensim #90

LeonardWilleke opened this issue Mar 13, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@LeonardWilleke
Copy link

LeonardWilleke commented Mar 13, 2024

Hi, first of all thanks for developing this clean and handy tool.

When I call nlp.train_lda_model() I get the following error:

ModuleNotFoundError: No module named 'gensim.models.lda'

This makes sense, because I am using gensim 4.2 which doesn't have this module but instead a module called gensim.models.ldamodel. As I understand, litstudy.nlp should detect which version of gensim I am running here:

https://github.com/NLeSC/litstudy/blob/fcb82e860c6c5bc6bf4573b2207e194ba6f6f0b1/litstudy/nlp.py#L323C5-L336C67

Unfortunately, this doesnt seem to work.

When using gensim 3.x, I get errors from different functions. I tried gensim 3.0 - 3.5 and 4.0 - 4.2.

Best regards,
Leonard

@isazi isazi added the bug Something isn't working label Mar 14, 2024
@LeonardWilleke
Copy link
Author

from importlib.metadata import version

gensim_mayor = int(version("gensim").split(".")[0])

So far I used Python==3.7 as stated in the README, but the module importlib.metadata seems to be only available for Python >= 3.8: https://docs.python.org/3/library/importlib.metadata.html#module-importlib.metadata

However with Python 3.8 some other packages fail, probably need to reinstall them.

@LeonardWilleke
Copy link
Author

The original error returned after re-installing the other packages. I found that importlib.metadata and gensim work as intended. This simple script

import gensim
from importlib.metadata import version

gensim_mayor = int(version("gensim").split(".")[0])
print(gensim_mayor)

returns 4 as expected. I'm puzzled.

@Tim0th1
Copy link

Tim0th1 commented Apr 3, 2024

Litstudy is great. Also agree with this bug as reported.

Temporarily, the NMF topic model is a working substitute and does not require the gensim_mayor version control.

@hapuuma
Copy link

hapuuma commented Sep 8, 2024

Any news regarding LDA?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants