I came across this page where answerers have suggested that I can just use nltk on a machine without having root access. I'm trying to follow the advice there but I'm doing something wrong.
I downloaded the source from here (the file named setuptools-0.6c11.tar.gz) and then I extracted it to a folder called nltk.
Now from the third answer on that link, I should be able to import nltk by running Python from one of the folders of the extracted contents right?
So I tried running python from the following directories and then importing nltk:
~/nltk/
~/nltk/setuptools/
~/nltk/setuptools.egg-info/
~/nltk/setuptools/command/
~/nltk/setuptools/tests/
But I can't import the module from anywhere. I'm a Python rookie. Can anyone tell me what I'm doing wrong?
I actually need to use nltk for a university project and I do not have access root access to the university computers where these projects will run on.
Firstly, from your question it sounds like you're trying to unpack setuptools and import nltk from it. Those are two totally separate projects.
Secondly, if you want to easily build nltk from source and run it as a normal user, you probably want to start off by using virtualenv. On debian you can just install it with apt-get install python-virtualenv.
Once virtualenv is installed, you can do
virtualenv nltk_env --system-site-packages
to create a partially-isolated environment where you can install nltk without messing up your system installation. Then just do
source nltk_env/bin/activate
pip install nltk
python
>>> import nltk
and you've successfully imported your local nltk installation.
There are other options for installing locally and not using virtualenv, like pip install --user nltk, but they can be more confusing if you don't know what you're doing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With