microsoft/presidio

SystemExit error when calling AnalyzerEngine()

KelumPerera opened this issue · 2 comments

I get this error when calling 'AnalyzerEngine()'

%tb
from presidio_analyzer import AnalyzerEngine
analyzer = AnalyzerEngine()
Traceback (most recent call last):

  Cell In[7], line 2
    analyzer = AnalyzerEngine()

  File C:\Python\Lib\site-packages\presidio_analyzer\analyzer_engine.py:64 in __init__
    nlp_engine = provider.create_engine()

  File C:\Python\Lib\site-packages\presidio_analyzer\nlp_engine\nlp_engine_provider.py:100 in create_engine
    engine.load()

  File C:\Python\Lib\site-packages\presidio_analyzer\nlp_engine\spacy_nlp_engine.py:57 in load
    self._download_spacy_model_if_needed(model["model_name"])

  File C:\Python\Lib\site-packages\presidio_analyzer\nlp_engine\spacy_nlp_engine.py:64 in _download_spacy_model_if_needed
    spacy.cli.download(model_name)

  File C:\Python\Lib\site-packages\spacy\cli\download.py:90 in download
    download_model(filename, pip_args)

  File C:\Python\Lib\site-packages\spacy\cli\download.py:176 in download_model
    run_command(cmd)

  File C:\Python\Lib\site-packages\spacy\util.py:1034 in run_command
    sys.exit(ret.returncode)

SystemExit: 1

An exception has occurred, use %tb to see the full traceback.

SystemExit: 1

Version deatils:
Windows 10,
Python 3.11.3
presidio_analyzer-2.2.355
presidio_anonymizer-2.2.355
en_core_web_sm-2.3.0

pip install  presidio_analyzer
pip install presidio_anonymizer
pip install C:\Users\MyPC\Downloads\en_core_web_sm-2.3.0.tar.gz --no-deps --user

Any help to sort this

If you'd like to use the en_core_web_sm model instead of the default en_core_web_lg model, you have to specify this to the Analyzer Engine. Looks like it's failing because it can't download en_core_web_lg.

To change the default model, see this doc: https://microsoft.github.io/presidio/analyzer/customizing_nlp_models/#Configure-Presidio-to-use-the-new-model

If you'd like to use the en_core_web_sm model instead of the default en_core_web_lg model, you have to specify this to the Analyzer Engine. Looks like it's failing because it can't download en_core_web_lg.

To change the default model, see this doc: https://microsoft.github.io/presidio/analyzer/customizing_nlp_models/#Configure-Presidio-to-use-the-new-model

Thanks you, After Installing "en_core_web_lg" it worked.