0

When I run the following Python code in my local Jupyter notebook (in macOS)

import nltk
from nltk.corpus import stopwords
nltk.download('stopwords')

I got the following errors:

[nltk_data] Error loading stopwords: <urlopen error [SSL:
[nltk_data]     CERTIFICATE_VERIFY_FAILED] certificate verify failed:
[nltk_data]     unable to get local issuer certificate (_ssl.c:992)>

Any input is appreciated.

Sophia
  • 377
  • 1
  • 12
  • Does this work ? `python -c "import nltk;nltk.download('stopwords')"` – razimbres Jun 11 '23 at 00:26
  • I typed in the above code from the terminal, and it gave me the following error: `zsh: command not found: python`. – Sophia Jun 11 '23 at 00:28
  • 1
    I solved the problem by typing in `sh "/Applications/Python 3.11/Install Certificates.command"` in my terminal. I got hint from this link (https://stackoverflow.com/questions/41348621/ssl-error-downloading-nltk-data?rq=2) – Sophia Jun 11 '23 at 00:34
  • Please post as an answer to your own question. – razimbres Jun 11 '23 at 00:36
  • Sure, and thanks for your guidance. – Sophia Jun 11 '23 at 00:56

1 Answers1

3

I solved the problem by typing in sh "/Applications/Python 3.11/Install Certificates.command" in my terminal. I got hint from this link (SSL error downloading NLTK data).

Sophia
  • 377
  • 1
  • 12