I am using nltk.download() to download the packages i need. But i am getting the following error.
root@nishant-Inspiron-1545:/home/nishant/Dropbox/DDP/data# python
Python 2.7.3 (default, Apr 10 2013, 05:09:49) [GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import nltk
>>> import nltk.downloader
>>> nltk.download()
NLTK Downloader
---------------------------------------------------------------------------
d) Download l) List c) Config h) Help q) Quit
---------------------------------------------------------------------------
Downloader> d
Download which package (l=list; x=cancel)?
Identifier> l
Packages:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/nltk/downloader.py", line 644, in download
self._interactive_download()
File "/usr/lib/python2.7/dist-packages/nltk/downloader.py", line 964, in _interactive_download
DownloaderShell(self).run()
File "/usr/lib/python2.7/dist-packages/nltk/downloader.py", line 1000, in run
self._simple_interactive_download(args)
File "/usr/lib/python2.7/dist-packages/nltk/downloader.py", line 1019, in _simple_interactive_download
more_prompt=True, skip_installed=True)
File "/usr/lib/python2.7/dist-packages/nltk/downloader.py", line 453, in list
for info in sorted(getattr(self, category)()):
File "/usr/lib/python2.7/dist-packages/nltk/downloader.py", line 475, in packages
self._update_index()
File "/usr/lib/python2.7/dist-packages/nltk/downloader.py", line 814, in _update_index
ElementTree.parse(urllib2.urlopen(self._url)).getroot())
File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen
return _opener.open(url, data, timeout)
File "/usr/lib/python2.7/urllib2.py", line 407, in open
response = meth(req, response)
File "/usr/lib/python2.7/urllib2.py", line 520, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python2.7/urllib2.py", line 445, in error
return self._call_chain(*args)
File "/usr/lib/python2.7/urllib2.py", line 379, in _call_chain
result = func(*args)
File "/usr/lib/python2.7/urllib2.py", line 528, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 407: Proxy Authentication Required
I checked my environment file in /etc and the http_proxy variable is set there. I dunno why i'm still getting this error. Please could someone point out? Thanks
nltk have shifted from the googlecode.com but still most of the resources on web continues to give its reference.
update the current data server setting in "/usr/lib/python2.7/dist-packages/nltk/downloader.py" file on line 370 from:
to
Changing the URL as stated in the other answer is required, but the other problem is proxy authentication. Use the export command and set all the proxy variables i.e. http, https, ftp and socks, like so.
Similarly ftp_proxy.
to see if the variables are set use
export -p
The password may or may not be within quotes. The
apt.conf
file should also have these setting as explained in many other sites.