spaCy add_pipe() and analyze_pipes() error

Viewed 38

I am new to spaCy and I need help with the following errors. I pretty much grab the code from the spaCy website. It works on its website but not in my jupyternotebook.

  1. When I ran the following code:

    import spacy

    nlp = spacy.blank("en") nlp.add_pipe("tagger")

I have the following error:

ValueError: [E003] Not a valid pipeline component. Expected callable, but got 'tagger' (name: 'None').[E004] If you meant to add a built-in component, use create_pipe: nlp.add_pipe(nlp.create_pipe('tagger'))

  1. When I ran the following code:

    import spacy

    nlp = spacy.blank("en") nlp.add_pipe(nlp.create_pipe("tagger")) nlp.add_pipe(nlp.create_pipe("entity_linker")) analysis = nlp.analyze_pipes(pretty=True)

I received the following error:

AttributeError: 'English' object has no attribute 'analyze_pipes'

1 Answers

It looks like your notebook is using spaCy v2, but the website is for spaCy v3, which was released over a year ago. You should upgrade spaCy. For example with pip you can do pip install -U spacy.

Related