ModuleNotFoundError while following the DVC course

I am following the Iterative Tools for Data Scientists & Analysts course step by step, so far everything was going smoothly, but now I am at task 3.5 and when I am trying to follow along the course and execute dvc repro I get:

ModuleNotFoundError: No module named 'src'
ERROR: failed to reproduce 'dvc.yaml': failed to run: python src/stages/ --config=params.yaml, exited with 1

I am having same branch and files as in the course so not sure why it is not working.
I tried adding to the folder but didn’t help.

Hi SnailTheSnail!

I did some digging in Discord and found this similar messages: Discord

The problem it seems may be the setup with .env. Per the Discord message:
“Tbh, I’m not sure we support the pure setup via .env file with env vars in it. We would need to add the same setting in the config file, or “learn” how to use the existing one. I think this is a related discussion - Improve Python environment activation · Issue #1791 · iterative/vscode-dvc · GitHub … Could you please chime in there?”

You may want to try setup with venv instead. The README has the instructions. This line may help:

echo “export PYTHONPATH=$PWD” >> dvc-venv/bin/activate
source dvc-venv/bin/activate

Let us know if these aren’t fruitful and we will help figure it out!