TakeLab / spacy-udpipe

spaCy + UDPipe
MIT License
159 stars 11 forks source link

'NoneType' object has no attribute 'newTokenizer'` #45

Open CMallart opened 1 year ago

CMallart commented 1 year ago

Hello,

I installed spacy-udpipe from the Pypi repo using the following pip install spacy-udpipe

When I follow the tutorial code from the Pypi package tutorial

import spacy_udpipe
spacy_udpipe.download("en") # download English model
text = "Wikipedia is a free online encyclopedia, created and edited by volunteers around the world."
nlp = spacy_udpipe.load("en")
doc = nlp(text)

it raises the following error

Already downloaded a model for the 'en' language
Traceback (most recent call last):
  File "/home/adr2.local/mallart_c/a4ll/udpipe-microservice/app/spacy_parser.py", line 8, in <module>
    doc = nlp(text)
  File "/home/adr2.local/mallart_c/a4ll/venv/lib/python3.8/site-packages/spacy/language.py", line 999, in __call__
    doc = self._ensure_doc(text)
  File "/home/adr2.local/mallart_c/a4ll/venv/lib/python3.8/site-packages/spacy/language.py", line 1090, in _ensure_doc
    return self.make_doc(doc_like)
  File "/home/adr2.local/mallart_c/a4ll/venv/lib/python3.8/site-packages/spacy/language.py", line 1082, in make_doc
    return self.tokenizer(text)
  File "/home/adr2.local/mallart_c/a4ll/venv/lib/python3.8/site-packages/spacy_udpipe/tokenizer.py", line 83, in __call__
    udpipe_sents = self.model(text=text) if text else [Sentence()]
  File "/home/adr2.local/mallart_c/a4ll/venv/lib/python3.8/site-packages/spacy_udpipe/udpipe.py", line 99, in __call__
    sentences = self.tokenize(text)
  File "/home/adr2.local/mallart_c/a4ll/venv/lib/python3.8/site-packages/spacy_udpipe/udpipe.py", line 144, in tokenize
    tokenizer = self.model.newTokenizer(self.model.DEFAULT)
AttributeError: 'NoneType' object has no attribute 'newTokenizer'

I am using spacy==3.5.0 and spacy-udpipe==1.0.0 inside of a Python 3.8.10 venv. I have also installed spacy-conll==3.3.0 and spacy-transformers==1.2.1.

loctimize-sheth commented 11 months ago

Hi, Can we please get help for the above mentioned issue please? I'm getting the same error for Bulgarian.

Already downloaded a model for the 'bg' language

Error
Traceback (most recent call last):

  File "test_venv/lib/python3.9/site-packages/spacy/language.py", line 1014, in __call__
    doc = self._ensure_doc(text)
  File "test_venv/lib/python3.9/site-packages/spacy/language.py", line 1105, in _ensure_doc
    return self.make_doc(doc_like)
  File "test_venv/lib/python3.9/site-packages/spacy/language.py", line 1097, in make_doc
    return self.tokenizer(text)
  File "test_venv/lib/python3.9/site-packages/spacy_udpipe/tokenizer.py", line 83, in __call__
    udpipe_sents = self.model(text=text) if text else [Sentence()]
  File "test_venv/lib/python3.9/site-packages/spacy_udpipe/udpipe.py", line 99, in __call__
    sentences = self.tokenize(text)
  File "test_venv/lib/python3.9/site-packages/spacy_udpipe/udpipe.py", line 144, in tokenize
    tokenizer = self.model.newTokenizer(self.model.DEFAULT)
AttributeError: 'NoneType' object has no attribute 'newTokenizer'

Appreciate your response at the soonest!