Akhlaq Ahmed
Akhlaq Ahmed

Reputation: 96

Stanza Stanford NLP: cannot import name 'StanzaLanguage' from 'spacy_stanza'

I'm getting the following error when importing StanzaLanguage from spacy_stanza:

ImportError Traceback (most recent call last) in () 4 import stanza 5 stanza.download('es') ----> 6 from spacy_stanza import StanzaLanguage 7 8

ImportError: cannot import name 'StanzaLanguage' from 'spacy_stanza' (/usr/local/lib/python3.7/dist-packages/spacy_stanza/init.py)

Upvotes: 3

Views: 1598

Answers (1)

Spec
Spec

Reputation: 847

I think you've installed newest spacy-stanza but you're trying to use it with older spaCy:

As of v1.0.0 spacy-stanza is only compatible with spaCy v3.x. For spaCy v2, install v0.2.x
pip install "spacy-stanza<0.3.0"

Take a look what are the differences in Usage & Examples between them: https://github.com/explosion/spacy-stanza vs https://github.com/explosion/spacy-stanza/tree/v0.2.x#-usage--examples

Upvotes: 2

Related Questions