Closed pratyushmittal closed 4 years ago
Yep, same error on Python 2.7.17, when trying to install corpora
python -m textblob.download_corpora
Error:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/runpy.py", line 163, in _run_module_as_main
mod_name, _Error)
File "/usr/local/lib/python2.7/runpy.py", line 102, in _get_module_details
loader = get_loader(mod_name)
File "/usr/local/lib/python2.7/pkgutil.py", line 462, in get_loader
return find_loader(fullname)
File "/usr/local/lib/python2.7/pkgutil.py", line 472, in find_loader
for importer in iter_importers(fullname):
File "/usr/local/lib/python2.7/pkgutil.py", line 428, in iter_importers
__import__(pkg)
File "/usr/local/lib/python2.7/site-packages/textblob/__init__.py", line 2, in <module>
from .blob import TextBlob, Word, Sentence, Blobber, WordList
File "/usr/local/lib/python2.7/site-packages/textblob/blob.py", line 28, in <module>
import nltk
File "/usr/local/lib/python2.7/site-packages/nltk/__init__.py", line 128, in <module>
from nltk.collocations import *
File "/usr/local/lib/python2.7/site-packages/nltk/collocations.py", line 35, in <module>
from nltk.probability import FreqDist
File "/usr/local/lib/python2.7/site-packages/nltk/probability.py", line 333
print("%*s" % (width, samples[i]), end=" ")
^
SyntaxError: invalid syntax
Fixed by adding the static nltk==3.4.5
in requirements.txt
Yup, Same error. Does this mean I need to manually download this library and compile it from source?
@Romiko You need to pin to nltk==3.4.5
as suggested above.
https://github.com/sloria/TextBlob/pull/318 pins the NLTK version based on Python version, so that a compatible version of NLTK automatically gets installed.
For now, though, you'll just need to pin NLTK manually.
It seems
nltk
library released version 3.5 today. It is Python 3 only. This breaks textblob on Python 2.I was able to fix the errors by adding the static nltk==3.4.5 in requirements.