I am trying to deploy a google cloud function with lemmatization and tokenizer from NLTK library of python. NLTK required punct and wordnet packages to be downloaded using

```
import nltk
nltk.download('punct')
nltk.download('wordnet')

```

Hence these cannot be specified in the requirements.txt file. The only thing that can be mentioned in requirement.txt is nltk.

I did go over [this similar question](https://stackoverflow.com/questions/56586527/how-to-add-nltk-corpora-to-a-google-cloud-function) that lead me to google documentation page about [specifying dependencies in python](https://cloud.google.com/functions/docs/writing/specifying-dependencies-python) and followed all steps there.

First I moved entire virtual environment's dependencies into a directory called lib using

```
pip install -t lib nltk

```

And then I created `__init__.py` file inside the lib directory. And changed all my import statement to import from lib. However, when using the nltk package from lib directory, I constantly get error thrown which I believe is due to relative path.

`Traceback (most recent call last):
 File "main.py", line 1, in <module>
 from lib.nltk.stem import WordNetLemmatizer
 File "/Users/aakashpatel/Documents/resume-compare/lib/nltk/__init__.py", line 99, in <module>
 from nltk.internals import config_java
ModuleNotFoundError: No module named 'nltk'`

And if I look under `lib/nltk` folder's `__init__.py` file there is an import statement `from nltk.internals import config_java` which it cannot find because it has to be converted to `from lib.nltk.internals import config_java`. And I cannot just go ahead and change this one thing because there will be lot of other places where the import is simply mentioned as from nltk or something.

How can I solve this issue? Am I not following all steps for deploying to Google Cloud Function properly?