Skip to content

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

@CMallart

Description

@CMallart

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions