Problems installing prodigy in conda environment: No module named 'prodigy.util'

Hello!
After having installed the prodigy module in my conda environment, running the command python -m prodigy stats returned the following output:

Traceback (most recent call last):
  File "C:\Users\cedric.mingneau\Miniconda3\envs\ner\lib\runpy.py", line 188, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "C:\Users\cedric.mingneau\Miniconda3\envs\ner\lib\runpy.py", line 147, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "C:\Users\cedric.mingneau\Miniconda3\envs\ner\lib\runpy.py", line 111, in _get_module_details
    __import__(pkg_name)
  File "C:\Users\cedric.mingneau\Miniconda3\envs\ner\lib\site-packages\prodigy\__init__.py", line 1, in <module>
    from .util import init_package
ModuleNotFoundError: No module named 'prodigy.util'

I'm running windows and have updated python, pip and wheel.
My environment only has python 3 (64-bit) installed.

These are the steps I followed while installing prodigy:

  • I tried to install using the wheel file. This didn't work, it returned the is not a supported wheel message.
  • I double-checked if I was using the right wheel file (I also ran distutils.util.get_platform()), no problems there
  • I manually extracted the contents to my conda environments's site-packages directory
  • Running conda list shows the prodigy module

Is there something special I need to do for it to work in a conda environment?
Thanks in advance!

Hi! Can you check which Python version you're running? The latest stable release currently supports 3.6, 3.7 and 3.8. If you have 3.9, this could be an explanation (and it'd explain why Prodigy installs but can't find the compiled files).

This turned out to be the problem. After updating python I ended up with python 3.9.*. Downgrading to python 3.8.* made it possible to install the wheel.

Unfortunately I still wasn't able to run python -m prodigy stats: it kept returning missing module errors. I ended up manually installing a whole bunch of them (murmurhash, numpy, blis, pytorch, thinc etc.). After doing all of that I was still getting an error message:
ImportError: cannot import name 'wrap' from 'thinc.api'

I kind of ran out of inspiration at that point. Since installing all those seperate modules was turning my site-packages into a mess, I decided to create a new conda environment. This completely solved the problem. I was able to run python -m prodigy stats.
The conda environment that was causing all the problems did have spacy (and all its dependencies) installed. I'm guessing there was some kind of version/dependency mismatch going on?

Sorry you were environment issues, I can definitely relate – sometimes, re-installing and uninstalling things can lead to stale artifacts in your environment and you can end up in a weird state where the only solution is to delete your environment and start again (so yay for virtual environments!).

One possible explanation in your case is that you likely ended up with Python 3.9 artifacts of the installed packages, which were not updated when you changed your version. That could also be why you only saw missing module errors for other packages with C extensions that have to be compiled for specific Python versions (Numpy, PyTorch, Thinc etc).

conda in particular also does more in-depth dependency resultion, which can be helpful to prevent conflicts, but also means that you can end up with unexpectedly upgraded/downgraded versions depending on the state of your environment. (Years ago, there was a problem with some packagage spaCy depended on and people's installations kept being downgraded to spaCy 0.100, which was the last matching "compatible" version :sweat_smile:)

I think you're spot on! Or at least, your explanation seems to make a lot of sense. Anyway, I'm not going to investigate it any further, as that would pull me deeper into the rabbit hole :sweat_smile:

Don't worry about my issues with my environment, I shouldn't have been stubborn when the documentation explicitly stated:

It’s recommended to use a new virtual environment for installing Prodigy.

So thank you for bearing with me and helping me out! :slightly_smiling_face: