Issue with import from LatentDirichletAllocation
See original GitHub issueSome people are getting an issue after updating scikit-learn:
File "/home/jupyter/.local/lib/python3.5/site-packages/sklearn/decomposition/__init__.py", line 19, in <module>
from ._online_lda import LatentDirichletAllocation
ImportError: cannot import name 'LatentDirichletAllocation'
There an SO question about it: https://stackoverflow.com/questions/59240556/latentdirichletallocation-was-not-installed-in-decomposition-module-of-scikit-le
and we got an issue reported in imbalanced-learn: https://github.com/scikit-learn-contrib/imbalanced-learn/issues/663
I assume that this is not just bad luck. However, I cannot reproduce it locally. It is for sure linked to the privatization of the online_lda
module but I don’t get how to trigger that.
NB: I will write an answer in the so because the “solution” is a really bad fix and if we could get feedback on this issue to solve it, it would be great.
Issue Analytics
- State:
- Created 4 years ago
- Comments:19 (18 by maintainers)
Top Results From Across the Web
cannot import name 'LatentDirichletAllocation' from 'sklearn ...
I think this might be a problem with conda install sklearn version 0.22 as questioned in this issues. Try pip install -U scikit-learn....
Read more >sklearn.decomposition.LatentDirichletAllocation
LatentDirichletAllocation : Topic extraction with Non-negative Matrix Factorization ... from sklearn.decomposition import LatentDirichletAllocation >>> from ...
Read more >Latent Dirichlet Allocation using Scikit-learn
In this tutorial, we will focus on Latent Dirichlet Allocation (LDA) and perform topic modeling using Scikit-learn.
Read more >Topic Modeling using Latent Dirichlet Allocation - easiest way
Step 1 – Importing required libraries. Step 2 – Reading input data. Step 3 – Checking info of our data. Step 4 –...
Read more >Topic Modeling in Python: Latent Dirichlet Allocation (LDA)
It is key to understanding the data and ensuring we are on the right track, and if any more preprocessing is necessary before...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
OK so the issue is due to the following file
_online_lda.cpython-36m-x86_64-linux-gnu.so
Before we had a
_online_lda.pyx
and therefore we were generated the associatedso
file. We renamed it to_online_lda_fast.pyx
. In the same time, we renamedonline_lda.py
to_online_lda.py
.Basically, during
pip install scikit-learn -U
, the.so
does not get removed and we have a collision between the naming. To solve this issue, you need to remove the file by hand.I think _k_means.py[x] and _hierarchical.py[x] also qualify