srbhr / Resume-Matcher

Resume Matcher is an open source, free tool to improve your resume. It works by using language models to compare and rank resumes with job descriptions.
https://www.resumematcher.fyi/
Apache License 2.0
4.76k stars 1.93k forks source link

Resource punkt not found. #72

Closed surenganne closed 1 year ago

surenganne commented 1 year ago

I am getting the below error and unable to test it. I am trying this on my mac

(Resume-Matcher) ➜ Resume-Matcher git:(main) ✗ streamlit run streamlit_app.py

You can now view your Streamlit app in your browser.

Local URL: http://localhost:8501 Network URL: http://192.168.0.103:8501

[nltk_data] Error loading punkt: <urlopen error [SSL: [nltk_data] CERTIFICATE_VERIFY_FAILED] certificate verify failed: [nltk_data] unable to get local issuer certificate (_ssl.c:1002)> 2023-07-27 16:49:19.424 Uncaught app exception Traceback (most recent call last): File "/Users/kas772/Surendra/Resume-Matcher/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 552, in _run_script exec(code, module.dict) File "/Users/kas772/Surendra/Resume-Matcher/streamlit_app.py", line 160, in annotated_text(create_annotated_text( ^^^^^^^^^^^^^^^^^^^^^^ File "/Users/kas772/Surendra/Resume-Matcher/streamlit_app.py", line 86, in create_annotated_text tokens = nltk.word_tokenize(input_string) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/kas772/Surendra/Resume-Matcher/lib/python3.11/site-packages/nltk/tokenize/init.py", line 129, in word_tokenize sentences = [text] if preserve_line else sent_tokenize(text, language) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/kas772/Surendra/Resume-Matcher/lib/python3.11/site-packages/nltk/tokenize/init.py", line 106, in sent_tokenize tokenizer = load(f"tokenizers/punkt/{language}.pickle") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/kas772/Surendra/Resume-Matcher/lib/python3.11/site-packages/nltk/data.py", line 750, in load opened_resource = _open(resource_url) ^^^^^^^^^^^^^^^^^^^ File "/Users/kas772/Surendra/Resume-Matcher/lib/python3.11/site-packages/nltk/data.py", line 876, in open return find(path, path + [""]).open() ^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/kas772/Surendra/Resume-Matcher/lib/python3.11/site-packages/nltk/data.py", line 583, in find raise LookupError(resource_not_found) LookupError:


Resource punkt not found. Please use the NLTK Downloader to obtain the resource:

import nltk nltk.download('punkt')

For more information see: https://www.nltk.org/data.html

Attempted to load tokenizers/punkt/PY3/english.pickle

Searched in:

srbhr commented 1 year ago

Hi @surenganne Punkt is missing in your system. Activate your venv and via terminal do:



$python3
>>> import nltk
>>> nltk.download('punkt')

`
surenganne commented 1 year ago

➜ Resume-Matcher git:(main) ✗ python3 -m venv Resume-Matcher ➜ Resume-Matcher git:(main) ✗ ➜ Resume-Matcher git:(main) ✗ source Resume-Matcher/bin/activate (Resume-Matcher) ➜ Resume-Matcher git:(main) ✗ python3 Python 3.11.3 (v3.11.3:f3909b8bc8, Apr 4 2023, 20:12:10) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin Type "help", "copyright", "credits" or "license" for more information.

import nltk Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'nltk' nltk.download('punkt') Traceback (most recent call last): File "", line 1, in NameError: name 'nltk' is not defined

surenganne commented 1 year ago

(Resume-Matcher) ➜ Resume-Matcher git:(main) ✗ python3 Python 3.11.3 (v3.11.3:f3909b8bc8, Apr 4 2023, 20:12:10) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin Type "help", "copyright", "credits" or "license" for more information.

import nltk nltk.download('punkt') [nltk_data] Error loading punkt: <urlopen error [SSL: [nltk_data] CERTIFICATE_VERIFY_FAILED] certificate verify failed: [nltk_data] unable to get local issuer certificate (_ssl.c:1002)> False

srbhr commented 1 year ago

Hi, I think you have not installed the packages. After activating the virtual environment, have you done pip install -r requirements.txt

srbhr commented 1 year ago

(Resume-Matcher) ➜ Resume-Matcher git:(main) ✗ python3 Python 3.11.3 (v3.11.3:f3909b8bc8, Apr 4 2023, 20:12:10) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin Type "help", "copyright", "credits" or "license" for more information.

import nltk nltk.download('punkt') [nltk_data] Error loading punkt: <urlopen error [SSL: [nltk_data] CERTIFICATE_VERIFY_FAILED] certificate verify failed: [nltk_data] unable to get local issuer certificate (_ssl.c:1002)> False

Are you behind some proxy? If the issue still persists, then there is a workaround over here

Note: This workaround disabled SSL checks. Also, you can do:

import nltk
nltk.download()

This opens up a window and asks you to select which package to download.

surenganne commented 1 year ago
Screenshot 2023-07-27 at 6 01 28 PM
srbhr commented 1 year ago

Try this

import nltk
import ssl

try:
    _create_unverified_https_context = ssl._create_unverified_context
except AttributeError:
    pass
else:
    ssl._create_default_https_context = _create_unverified_https_context

nltk.download()

Ref

surenganne commented 1 year ago

I took this route and it worked. Thanks!

If the issue still persists, then there is a workaround over https://github.com/gunthercox/ChatterBot/issues/930#issuecomment-322111087

Note: This workaround disabled SSL checks.

srbhr commented 1 year ago

You're welcome!