I have a python project that looks like this:
project
-src
--data
---transformers_data.py
---evaluation.py
--models
---train.py
---utils.py
train.py imports functions from src.data.transformers_data like so:
from src.data.transformers_data import get_dataset, preprocess_data, get_label_list
and from models.utils like so:
from src.models.utils import get_json_from_s3
If I run train.py from the project directory, I get:
Error while finding module specification for 'src/models/train.py' (ModuleNotFoundError: No module named 'src/models/train')
I have tried:
- with and without -m notation
- exporting the path using export PYTHONPATH="${PYTHONPATH}:~/project" (and the sub-directories, too)
- running this script from basically every directory inside this project
- appending the full path to the import using
sys.path.append
- in a virtual environment and not in a virtual environment
I'm still getting this ModuleNotFound
error.
What have I not tried?