Question: I am trying to create executable python file using pyinstaller, but while loading hooks, it shows error like this,

```
24021 INFO:   Removing import of PySide from module PIL.ImageQt
24021 INFO: Loading module hook "hook-pytz.py"...
24506 INFO: Loading module hook "hook-encodings.py"...
24600 INFO: Loading module hook "hook-pandas.py"...
25037 INFO: Loading module hook "hook-lib2to3.py"...
25131 INFO: Loading module hook "hook-lxml.etree.py"...
25131 INFO: Loading module hook "hook-pycparser.py"...
25396 INFO: Loading module hook "hook-setuptools.py"...
25506 WARNING: Hidden import "setuptools.msvc" not found!
25506 INFO: Loading module hook "hook-distutils.py"...
25521 INFO: Loading module hook "hook-nltk.py"...
Unable to find "C:\nltk_data" when adding binary and data files.

```

I have tried coping nltk\_data from Appdata to C drive. but same error.

Answer: 
[This answer](https://stackoverflow.com/a/54760437/8379443) worked for me... it modifies the code in `hook-nltk.py` to only include the path if it exists.

`hook-nltk.py` can be found in your PyInstaller location within the hooks folder (something like <'path-to-python-installation'>\Lib\site-packages\PyInstaller\hooks)
I solved the problems editing the pyinstaller nltk-hook. After much research, I decided to go it alone in the code structure. I solved my problem by commenting on the lines:
`datas=[]`

`'''for p in nltk.data.path:
 datas.append((p, "nltk_data"))'''`

`hiddenimports = ["nltk.chunk.named_entity"]`

What's more, you need to rename the file: pyi\_rth\_\_nltk.cpython-36.pyc to pyi\_rth\_nltk.cpython-36.pyc . This file have 1 more underline. Warning with the python version.