Skip to content Skip to sidebar Skip to footer

Permissionerror When Downloading Nltk Data

I use Anaconda's Python 3.6.3 distribution and it comes with NLTK installed, but not with NLTK DATA, which I need for a project, the problem is, when I try to install with nltk.do

Solution 1:

Find out which directory you can write files to. E.g. if it's /home/alvas/testdir

Then

>>>pip install -U nltk>>>mkdir -p /home/alvas/testdir >>>python -m nltk.download popular -d /home/alvas/testdir 

If you want to know how to configure the custom path for nltk_data, at the start of your Python code:

import nltk
nltk.data.path.append('/home/alvas/testdir')

Solution 2:

Would something like this work ? Supposing your Anaconda env is called myenv.

source activate myenv
sudo python -c "import nltk; nltk.download()"

That's assuming having activated your env before would prevent using the base Linux's Python as you pointed out.

Post a Comment for "Permissionerror When Downloading Nltk Data"