Reputation: 64789
The NLTK docs say it supports Python 3.7. However, when I try to install it with:
virtualenv -p python3.7 .env
. .env/bin/activate
pip install nltk
I get the error:
Collecting nltk
Using cached https://files.pythonhosted.org/packages/f6/1d/d925cfb4f324ede997f6d47bea4d9babba51b49e87a767c170b77005889d/nltk-3.4.5.zip
ERROR: Command errored out with exit status 1:
command: /path/to/my/project/.env/bin/python3.7 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-12ut35ws/nltk/setup.py'"'"'; __file__='"'"'/tmp/pip-install-12ut35ws/nltk/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
cwd: /tmp/pip-install-12ut35ws/nltk/
Complete output (1 lines):
error in nltk setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers; Expected version spec in singledispatch; python_version < "3.4" at ; python_version < "3.4"
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
The error message sounds like NLTK only supports Python < 3.4, but that doesn't make any sense. What am I doing wrong?
Upvotes: 1
Views: 2616
Reputation: 27698
It is because the package format was not supported by the distutils, which indicates the package tools may be too old.
Upgrade pip
in the virtual environment.
pip install -U pip
pip install -U setuptools
Retry to install nltk
.
. .env/bin/activate
pip install nltk
If this still doesn't work. Provide log from pip install nltk -v
.
Upvotes: 3
Reputation: 6173
First of all you have to upgrade your pip by using this command
python -m pip install –upgrade pip
First of all you have to navigate to the location of the pip folder
C:\Users\Admin>cd C:\Python\Scripts
Then run this command
pip3 install nltk
hope it will work!
Upvotes: 1