1

I have installed LDA plibrary (using pip) I have a very simple test code (the next two rows)

import lda

print lda.datasets.load_reuters()

But i keep getting the error

AttributeError: 'module' object has no attribute 'datasets'

in fact i get that each time i access any attribute/function under lda!

Community
  • 1
  • 1
Samer Aamar
  • 1,298
  • 1
  • 15
  • 23
  • 3
    Do you have a module named `lda.py` or `lda.pyc` in the current directory? – John Gordon Jul 23 '16 at 01:04
  • You gave me a good direction to find the issue... it is silly mistake of mine that i named my py file 'lda.py' so python got confused and didn't load the LDA library due to that! Thanks John [if you submit an answer i will vote for it] – Samer Aamar Jul 23 '16 at 01:56
  • I've posted it as an answer. – John Gordon Jul 23 '16 at 02:00

2 Answers2

2

Do you have a module named lda.py or lda.pyc in the current directory?

If so, then your import statement is finding that module instead of the "real" lda module.

John Gordon
  • 29,573
  • 7
  • 33
  • 58
  • my own mistake was that i named my python program with same name 'lda.py' which confused the python ! in order to fix i just renamed my own program (and delete lda.pyc as well) – Samer Aamar Jul 24 '16 at 07:58
0

I meet the some error in mmcv library and solve it with

pip install --upgrade packaging

here is reference link, hope this could help you.

J.Zhao
  • 2,250
  • 1
  • 14
  • 12