boudinfl/pke

AttributeError: module 'pke' has no attribute 'unsupervised'

Closed this issue · 3 comments

joej commented

UPDATE -- pilot error! I'd have the test script named pke.py.
So, the error now, when running the pke_example.py script is:
ImportError: bad magic number in 'pke': b'\x03\xf3\r\n'

I will leave this in place, for others who do similar, silly errors ................................
........................

python 3.6.7
When typed in by HAND into a live python3 shell, it works & I get keyphrase tuples.
When running the cut/pasted code example:

$ python3  /tmp/pke.py 
Traceback (most recent call last):
  File "/tmp/pke.py", line 2, in <module>
    import pke
  File "/tmp/pke.py", line 5, in <module>
    extractor = pke.unsupervised.TopicRank()
AttributeError: module 'pke' has no attribute 'unsupervised'
joej commented

Even though just installed, I did "pip3 install -U git+https://github.com/boudinfl/pke.git"
Still same err

joej commented

Just for fun, I pprint the ouput and ran it like this: cat /tmp/pke.py | python3
Note the deprecation issue. That causing the problem?

/home/xxxx/.local/lib/python3.6/site-packages/sklearn/externals/joblib/__init__.py:15: DeprecationWarning: sklearn.externals.joblib is deprecated in 0.21 and will be removed in 0.23. Please import this functionality directly from joblib, which can be installed with: pip install joblib. If this warning is raised when loading pickled models, you may need to re-serialize those models with scikit-learn 0.21+.
  warnings.warn(msg, category=DeprecationWarning)

[('solidified sample', 0.0418720801437291),
 ('composition', 0.026970672229117868),
 ('unit gravity directional solidification experiments', 0.024256539503173042),
 ('monotectics', 0.021900492107741226),
 ('hypermonotectic', 0.02110089245442082),
 ('growth', 0.019533383147427093),
 ('eutectic alloy systems', 0.018375164276896665),
 ('microgravity conditions', 0.01796667241324412),
 ('alloys', 0.017569823914807766),
 ('microstructure', 0.017416300657908227)]

joej commented

Sorry - I'm an idiot. The test script was named pke.py ... conflicting with the pke module name.

when renamed, is now giving this:
ImportError: bad magic number in 'pke': b'\x03\xf3\r\n'