Installation of nltk-3.0a3 for python3.3.3 - "ImportError: No module named 'setuptools'"

2.7k views Asked by At

I have installed Python 3.3.3 with a command:

sudo apt-get install python3

I am calling it as Python3, because I have Python 2.7 installed as well.

I have also installed distribute (setuptools) with a command:

sudo apt-get install python3-setuptools

To be sure, setuptools are installed for python3, I have searched with pip3 and I received an output:

$ pip3 search setuptools
setuptools                - Easily download, build, install, upgrade, and
                            uninstall Python packages
INSTALLED: 2.0 (latest)

Now I want to install NLTK's version for Python 3, so nltk3.0a3. I have downloaded it from the official site, and in the folder I ran a standard python installation and received an output:

$ python3 setup.py install
Traceback (most recent call last):
  File "setup.py", line 33, in <module>
    from setuptools import setup, find_packages
ImportError: No module named 'setuptools'

And in fact, when I go to python3 command line, for that input, I see the output:

>>> help('modules setup')
ez_setup - Bootstrap setuptools installation
setup 
unittest.test.test_setups

So there is really no module called setuptools...

Does anyone know what am I doing wrong? Or is there any other way of installing NLTK for python 3? (in apt, there is only NLTK for python 2).

Thanks a lot guys for any effort!

1

There are 1 answers

2
Steve Barnes On

You can use muon or your favorite package manager to install python3-setuptools and an experimental version of nltk supporting Python 3 is available at http://nltk.org/nltk3-alpha/

I suspect you will also need pyyaml and numpy installed for your python 3.

I gave this a try:

muon

check that I have installed python3-setuptools and python3-numpy

sudo pip3 install pyyaml

Having downloaded and unpacked the code from the above link

cd ~/ToolBuild/nltk-3.0a3/nltk-3.0a3
sudo python3 setup.py install
python3
Python 3.3.2+ (default, Oct  9 2013, 14:50:09) 
[GCC 4.8.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import nltk
>>> dir(nltk)
['AbstractLazySequence', 'AffixTagger', 'AlignedSent', 'Alignment', 'AnnotationTask', 'Assignment', 'BigramAssocMeasures', 'BigramCollocationFinder', 'BigramTagger', 'BinaryMaxentFeatureEncoding', 'BlanklineTokenizer', 'BottomUpChartParser', 'BottomUpLeftCornerChartParser', 'BottomUpProbabilisticChartParser', 'Boxer', 'BrillTagger', 'BrillTaggerTrainer', 'CfgReadingCommand', 'ChartParser', 'ChunkParserI',..........