Unresolved reference "prodigy.components.loaders"

I am trying to create some custom recipes, but when trying to import loaders the reference is not recognized by my IDE (Pycharm).
The same holds for prodigy.components.preprocess.
The import does work, it's just not recognized as a reference.
I'm using version 1.11.8 of prodigy.

hi @gwvdh,

Thanks for your question and welcome to the Prodigy community :wave:

  • How are you installing Prodigy?
  • Related, are you using a virtual environment and how you are you creating it?
  • Are you able to run the commands in terminal/python console (e.g., run python in terminal or find the "Python Console" button)?
  • What version of Python are you running? Prodigy requires 3.6+

I just tried on PyCharm Professional 2020.02 (I have only an older version) to run the sentiment recipe.py on a fresh virtual env/installation and I didn't have any problems.

Maybe as a last ditch effort you could try to append the location of the prodigy installation.

You can find where Prodigy is installed by running:

python -m prodigy stats

Where you'll find a Location path ("path/to/prodigy").

Now add to your prodigy recipe.py:

import sys
sys.path.append("path/to/prodigy") # Location of Prodigy installation

Let us know if you're still having issues or any further questions!

Hi @ryanwesslen,
Thank you for your reply!
It is not an important issue as executing works fine, it is more me trying to get a clean error log. Everything functions correctly and the installation seems to be working fine.

  • I'm installing Prodigy from a .whl file: prodigy-1.11.8-cp39-cp39-win_amd64.whl using pip install ./prodigy-1.11.8-cp39-cp39-win_amd64.whl from the virtual environment.
  • I am using a virtual environment Virtualenv, the default of PyCharm when creating a new project.
  • Yes I am able to run commands, including python -m prodigy stats and other prodigy commands.
  • I'm currently running python 3.9.7 using PyCharm Professional 2021.3

The odd thing is that it does recognize prodigy, as well as the components, just not the loaders subsection (see image below)

hi @gwvdh!

We suspect the problem may because those submodules are compiled from Cython.

I found this StackOverflow post that provides suggestions on how to correct:

Can you try and see if this works for you?

Hi @ryanwesslen
Thank you for your comments! I was not able to get it to work using the post you provided.
I additionally tried to use a conda virtual environment as per this post: https://intellij-support.jetbrains.com/hc/en-us/community/posts/360008700780-Pycharm-does-not-recognize-pyd-file-as-a-module

Looking at the Cython support for PyCharm, it seems that .pyd is not supported out of the box: Cython support | PyCharm
As it is not too big of a hindrance to me, since the execution works fine, I'll just use it in the current state.

Thank you for the support!