1

I tried to run "pip install nltk" but getting so many error. Though I tried to install dependencies which are causing error, but they are not getting installed as well.

Invalid requirement: 'nltk()'
Traceback (most recent call last):
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\_vendor\packagi
ng\requirements.py", line 92, in __init__
    req = REQUIREMENT.parseString(requirement_string)
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\_vendor\pyparsi
ng.py", line 1617, in parseString
    raise exc
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\_vendor\pyparsi
ng.py", line 1607, in parseString
    loc, tokens = self._parse( instring, 0 )
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\_vendor\pyparsi
ng.py", line 1379, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\_vendor\pyparsi
ng.py", line 3376, in parseImpl
    loc, exprtokens = e._parse( instring, loc, doActions )
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\_vendor\pyparsi
ng.py", line 1383, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\_vendor\pyparsi
ng.py", line 3164, in parseImpl
    raise ParseException(instring, loc, self.errmsg, self)
pip._vendor.pyparsing.ParseException: Expected stringEnd (at char 4), (line:1, c
ol:5)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\req\req_install
.py", line 82, in __init__
    req = Requirement(req)
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\_vendor\packagi
ng\requirements.py", line 96, in __init__
    requirement_string[e.loc:e.loc + 8]))
pip._vendor.packaging.requirements.InvalidRequirement: Invalid requirement, pars
e error at "'()'"

Please check screenshot for error: Error Screenshot

2

2 Answers 2

1

It seems you dont have permission to install packages. Try running the command line as administrator.

Sign up to request clarification or add additional context in comments.

Comments

1

Python package managment best practice is to create a virtual environment, see http://python-guide-pt-br.readthedocs.io/en/latest/dev/virtualenvs/

First install the virtualenv library for the local user

pip install --user virtualenv

See How to install python modules without root access? and PEP370

For Python2.7, create a virtual environment under the directory my_nltk_project

virtualenv -p /usr/bin/python2.7 my_nltk_project

Or in Python3:

virtualenv -p /usr/bin/python3.5 my_nltk_project
source my_nltk_project/bin/activate

Make sure Python3 is Py3.4 or Py3.5, Py3.6 is not yet officially support, see https://github.com/nltk/nltk/issues/1659

Now you should be within the virtual environment and your command prompt will look like this:

(my_nltk_project):~$ 

Now do a pip install:

pip install nltk

Optionally, use the -U option is to upgrade nltk (pip install -U nltk)

After you're done with the environment, simply do this to leave the environment:

(my_nltk_project):~$ deactivate

To reuse the environment:

:~$ source my_nltk_project/bin/activate

Alternatively, you could try this without the virtual environment:

pip install --user nltk

If you're on a Windows machine, it's strongly recommended that you use conda to manage NLTK packages, see https://gist.github.com/alvations/0ed8641d7d2e1941b9f9

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.