Error while `prodigy stats -l`

I am getting this error when i did ‘prodigy stats -l’

Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 183, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 142, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 109, in _get_module_details
__import__(pkg_name)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/prodigy/__init__.py", line 9, in <module>
from . import recipes  # noqa
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/prodigy/recipes/__init__.py", line 4, in <module>
from . import dep, ner, textcat, pos, compare, terms, generic, image  # noqa
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/prodigy/recipes/ner.py", line 16, in <module>
from ..models.ner import EntityRecognizer, merge_spans, guess_batch_size
File "cython_src/prodigy/models/ner.pyx", line 13, in init prodigy.models.ner
ImportError: cannot import name _cleanup

I thought i screwed up something and re-installed prodigy. when i do the same command, i get this error:

Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 183, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 142, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 109, in _get_module_details
__import__(pkg_name)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/prodigy/__init__.py", line 9, in <module>
from . import recipes  # noqa
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/prodigy/recipes/__init__.py", line 4, in <module>
from . import dep, ner, textcat, pos, compare, terms, generic, image  # noqa
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/prodigy/recipes/dep.py", line 5, in <module>
import spacy
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/spacy/__init__.py", line 11, in <module>
from .cli.info import info as cli_info
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/spacy/cli/__init__.py", line 6, in <module>
from .train import train  # noqa: F401
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/spacy/cli/train.py", line 16, in <module>
from .._ml import create_default_optimizer
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/spacy/_ml.py", line 11, in <module>
from thinc.misc import FeatureExtracter
ImportError: cannot import name 'FeatureExtracter'
1 Like

This looks like some weirdness with your environment and installed dependencies. Did you previously install / uninstall spaCy in the same environment? Does anything else work for you, like, running other Prodigy commands, importing spaCy etc?

If not, try installing everything in a fresh virtual environment from scratch.

I haven’t done installing for long… i got import error in spacy too. other prodigy commands do not work.

Found it!! I had installed spacy-stanfordnlp recently that screws up the env. uninstalling that and then reinstalling spacy and prodigy works.

Ahh, this makes sense. spacy-stanfordnlp depends on spacy-nightly, which pulled in all of its new dependencies (that aren’t compatible with the latest stable version). So you’ve ended up with dependency mismatches in your environment.

(So always use a fresh virtual environment :stuck_out_tongue_winking_eye:)

1 Like

I got this same error when building https://github.com/allenai/allennlp-demo in a fresh Conda environment (it depends on https://github.com/allenai/allennlp/releases/tag/v0.8.0). It looks like we also depended on nightly–hopefully this is fixed in v0.8.1.

This was probably only affecting me–for some reason fresh conda environments contained scispacy which brought in nightly.