ImportError: cannot import name ReLu

Hi, I’m running into the following problem when to run any of prodigy command. The following is my system.

  • OSX 10.13 (High Sierra)
  • Anaconda Python 3.5
  • The latest Prodigy
Traceback (most recent call last):
  File "/Users/kyoungrok/anaconda/envs/prodigy/lib/python3.5/runpy.py", line 183, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/Users/kyoungrok/anaconda/envs/prodigy/lib/python3.5/runpy.py", line 142, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/Users/kyoungrok/anaconda/envs/prodigy/lib/python3.5/runpy.py", line 109, in _get_module_details
    __import__(pkg_name)
  File "/Users/kyoungrok/anaconda/envs/prodigy/lib/python3.5/site-packages/prodigy/__init__.py", line 4, in <module>
    from . import recipes, about  # noqa
  File "/Users/kyoungrok/anaconda/envs/prodigy/lib/python3.5/site-packages/prodigy/recipes/__init__.py", line 4, in <module>
    from . import ner, textcat, compare, terms, generic # noqa
  File "/Users/kyoungrok/anaconda/envs/prodigy/lib/python3.5/site-packages/prodigy/recipes/textcat.py", line 11, in <module>
    from ..models.textcat import TextClassifier, add_text_classifier
  File "cython_src/prodigy/models/textcat.pyx", line 17, in init prodigy.models.textcat
ImportError: cannot import name ReLu

Thanks for the report and sorry about that! I think we might have not specified the version pin for spaCy and Thinc (spaCy’s machine learning library) explicitly enough, so it seems to have fetched the latest version released yesterday. Just working on an update to Prodigy that fixes this.

In the meantime, could you try downgrading spaCy to the previous version? This should make it work again.

pip uninstall spacy-nightly
pip install spacy-nightly==2.0.0a14

I tried what you suggested, and encountered another error

Traceback (most recent call last):
  File "/Users/kyoungrok/anaconda/envs/prodigy/lib/python3.6/runpy.py", line 183, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/Users/kyoungrok/anaconda/envs/prodigy/lib/python3.6/runpy.py", line 142, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/Users/kyoungrok/anaconda/envs/prodigy/lib/python3.6/runpy.py", line 109, in _get_module_details
    __import__(pkg_name)
  File "/Users/kyoungrok/anaconda/envs/prodigy/lib/python3.6/site-packages/prodigy/__init__.py", line 4, in <module>
    from . import recipes, about  # noqa
  File "/Users/kyoungrok/anaconda/envs/prodigy/lib/python3.6/site-packages/prodigy/recipes/__init__.py", line 4, in <module>
    from . import ner, textcat, compare, terms, generic # noqa
  File "/Users/kyoungrok/anaconda/envs/prodigy/lib/python3.6/site-packages/prodigy/recipes/textcat.py", line 9, in <module>
    from spacy.pipeline import SentenceSegmenter
  File "pipeline.pyx", line 1, in init spacy.pipeline
  File "arc_eager.pxd", line 12, in init spacy.syntax.parser
  File "search.pxd", line 72, in init spacy.syntax.arc_eager
ValueError: thinc.extra.search.MaxViolation has the wrong size, try recompiling. Expected 104, got 128

Ah damn – this is an error that we initially tried to fix with the recent update to spaCy and Thinc. Looks like this is the same problem described in this thread – can you try downgrading Thinc to 6.8.1?

pip uninstall thinc
pip install thinc=6.8.1

Sorry again :sweat: We’re currently working hard on getting an update ready for both spaCy and Prodigy that resolves those compatibility issues.

1 Like

I deleted the previous post because I see the following bug. Seems like thorough update would be needed. I can wait so don’t worry :smile:

command

prodigy dataset gh_issues "Classify issues on GitHub"
prodigy textcat.teach gh_issues en_core_web_sm "docs" --api github --label DOCUMENTATION

Bug

Traceback (most recent call last):
  File "/Users/kyoungrok/anaconda/envs/prodigy/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/Users/kyoungrok/anaconda/envs/prodigy/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/Users/kyoungrok/anaconda/envs/prodigy/lib/python3.6/site-packages/prodigy/__main__.py", line 235, in <module>
    controller = recipe(*args, use_plac=True)
  File "cython_src/prodigy/core.pyx", line 142, in prodigy.core.recipe.recipe_decorator.recipe_proxy
  File "cython_src/prodigy/util.pyx", line 172, in prodigy.util.suggest_view_id
  File "/Users/kyoungrok/anaconda/envs/prodigy/lib/python3.6/site-packages/toolz/itertoolz.py", line 368, in first
    return next(iter(seq))
  File "cython_src/prodigy/components/sorters.pyx", line 103, in __iter__
  File "cython_src/prodigy/components/sorters.pyx", line 29, in genexpr
  File "cython_src/prodigy/models/textcat.pyx", line 127, in __call__
  File "/Users/kyoungrok/anaconda/envs/prodigy/lib/python3.6/site-packages/spacy/language.py", line 462, in pipe
    for doc, context in izip(docs, contexts):
  File "/Users/kyoungrok/anaconda/envs/prodigy/lib/python3.6/site-packages/spacy/language.py", line 475, in pipe
    for doc in docs:
  File "pipeline.pyx", line 623, in pipe
  File "pipeline.pyx", line 628, in spacy.pipeline.TextCategorizer.predict
  File "/Users/kyoungrok/anaconda/envs/prodigy/lib/python3.6/site-packages/thinc/neural/_classes/model.py", line 161, in __call__
    return self.predict(x)
  File "/Users/kyoungrok/anaconda/envs/prodigy/lib/python3.6/site-packages/thinc/neural/_classes/feed_forward.py", line 35, in predict
    X = layer(X)
  File "/Users/kyoungrok/anaconda/envs/prodigy/lib/python3.6/site-packages/thinc/neural/_classes/model.py", line 161, in __call__
    return self.predict(x)
  File "/Users/kyoungrok/anaconda/envs/prodigy/lib/python3.6/site-packages/thinc/neural/_classes/model.py", line 125, in predict
    y, _ = self.begin_update(X)
  File "/Users/kyoungrok/anaconda/envs/prodigy/lib/python3.6/site-packages/thinc/api.py", line 131, in begin_update
    values = [fwd(X, *a, **k) for fwd in forward]
  File "/Users/kyoungrok/anaconda/envs/prodigy/lib/python3.6/site-packages/thinc/api.py", line 131, in <listcomp>
    values = [fwd(X, *a, **k) for fwd in forward]
  File "/Users/kyoungrok/anaconda/envs/prodigy/lib/python3.6/site-packages/thinc/api.py", line 213, in wrap
    output = func(*args, **kwargs)
  File "/Users/kyoungrok/anaconda/envs/prodigy/lib/python3.6/site-packages/thinc/neural/_classes/feed_forward.py", line 41, in begin_update
    X, inc_layer_grad = layer.begin_update(X, drop=drop)
  File "/Users/kyoungrok/anaconda/envs/prodigy/lib/python3.6/site-packages/spacy/_ml.py", line 625, in concatenate_lists_fwd
    flat_y, bp_flat_y = concat.begin_update(Xs, drop=drop)
  File "/Users/kyoungrok/anaconda/envs/prodigy/lib/python3.6/site-packages/thinc/api.py", line 131, in begin_update
    values = [fwd(X, *a, **k) for fwd in forward]
  File "/Users/kyoungrok/anaconda/envs/prodigy/lib/python3.6/site-packages/thinc/api.py", line 131, in <listcomp>
    values = [fwd(X, *a, **k) for fwd in forward]
  File "/Users/kyoungrok/anaconda/envs/prodigy/lib/python3.6/site-packages/thinc/api.py", line 213, in wrap
    output = func(*args, **kwargs)
  File "/Users/kyoungrok/anaconda/envs/prodigy/lib/python3.6/site-packages/thinc/neural/_classes/feed_forward.py", line 41, in begin_update
    X, inc_layer_grad = layer.begin_update(X, drop=drop)
  File "/Users/kyoungrok/anaconda/envs/prodigy/lib/python3.6/site-packages/thinc/api.py", line 235, in begin_update
    drop=drop)
  File "/Users/kyoungrok/anaconda/envs/prodigy/lib/python3.6/site-packages/thinc/check.py", line 145, in checked_function
    check(arg_id, fix_args, kwargs)
  File "cytoolz/functoolz.pyx", line 232, in cytoolz.functoolz.curry.__call__ (cytoolz/functoolz.c:3996)
  File "/Users/kyoungrok/anaconda/envs/prodigy/lib/python3.6/site-packages/thinc/check.py", line 67, in has_shape
    raise ShapeMismatchError(arg.shape, shape_values, shape)
thinc.exceptions.ShapeMismatchError:

	Shape mismatch: input (985, 0) not compatible with [None, 300].

	Traceback:
	β”œβ”€ <listcomp> [131] in api.py
	β”œβ”€β”€β”€ wrap [213] in api.py
	└───── begin_update [41] in neural/_classes/feed_forward.py
	       >>> X, inc_layer_grad = layer.begin_update(X, drop=drop)

Just sent out an update for Prodigy, v0.3.0, that should now be fully compatible with the latest spaCy alpha version! :tada:

Finally it works! Thanks!