1
$\begingroup$

I have previously used WHL (wheel) files to install various Python packages. But, it seems there's no such file for NLTK. Any workaround for this please?

https://pypi.org/project/nltk/

The problem is I don't have access to install or *.exe files. Neither PIP3 works because of some reason (firewall i believe!)

Error:

NewConnectionError('pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it',)': /simple/nltk/

Update-1

Just discovered, there was a Zip installation file. And tried it. Had a dependency on "singledispatch-3.4.0.3-py2.py3-none-any.whl" but was able to install that being a WHL file. Got a success message -

Installed c:\users\rb\appdata\local\programs\python\python36\lib\site-packages\nltk-3.4-py3.6.egg
Processing dependencies for nltk==3.4
Searching for singledispatch==3.4.0.3
Best match: singledispatch 3.4.0.3
Adding singledispatch 3.4.0.3 to easy-install.pth file

Using c:\users\rb\appdata\local\programs\python\python36\lib\site-packages
Searching for six==1.11.0
Best match: six 1.11.0
Adding six 1.11.0 to easy-install.pth file

Using c:\users\rb\appdata\local\programs\python\python36\lib\site-packages
Finished processing dependencies for nltk==3.4

Update-2

Still i wasn't able to do Import NLTK. But i noticed an Egg file in the Python folder.

C:\Users\rb>python -m easy_install "C:\Users\rb\AppData\Local\Programs\Python\Python36\Lib\site-packages\nltk-3.4-py3.6.egg"
Processing nltk-3.4-py3.6.egg
nltk 3.4 is already the active version in easy-install.pth

Installed c:\users\rb\appdata\local\programs\python\python36\lib\site-packages\nltk-3.4-py3.6.egg
Processing dependencies for nltk==3.4
Finished processing dependencies for nltk==3.4

Still i'm unable to proceed. But the hunt is still on ...

$\endgroup$
  • 1
    $\begingroup$ Any pointers please? What might be going wrong in the installation? $\endgroup$ – ranit.b Feb 14 at 10:10
  • 1
    $\begingroup$ I tried and tried, and finally, got the answer - Inside folder "site-packages" there was a sub-folder named "nltk-3.4-py3.6.egg" , inside which there was "nltk". I just copied the latter outside the *egg folder and placed it directly under "site-packages". Now happily accessible using import nltk :) $\endgroup$ – ranit.b Feb 14 at 13:41
  • 1
    $\begingroup$ You should post all of this as an answer on this site (you can answer your own question) so that it will help others in the future. $\endgroup$ – I_Play_With_Data Feb 14 at 17:30
  • 1
    $\begingroup$ Thanks. I encountered another issue installing 'Punkt'. It can be easily resolved (usually) using nltk.download() but in my case firewall or some other connection issue was restricting the download. I retorted to manual installation and fixed. Let me post the entire thing as answer. Thanks for the idea! $\endgroup$ – ranit.b Feb 15 at 13:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.