Salohy
08/10/2021, 8:13 AMModuleNotFoundError: No module named 'utils'
when running python file.py
It seems like that my local package utils is not found during docker build. Here is the structure of my folder.
src
utils/
file.py
__init__.py
I am using a custom docker image where I already copied every thing in src in the image.
Please help me on this. Any help is appreciated 🙏Many thanks alreadyGreg Roche
08/10/2021, 8:57 AMpip install -e .
to install your package locallySalohy
08/10/2021, 9:03 AMGreg Roche
08/10/2021, 9:31 AMimport utils.whatever
python commands which are at the top of your flow logic. If you're just running your agent on the other machine by starting a command line and running prefect agent local start
or something, then installing your package locally with the editable flag before starting the agent should be enough (or better, create and activate a venv, install all dependencies, then pip install -e .
, then start your agent from the venv). It's a bit cleaner if you run your agent from within a Docker container because then you can put all this setup in the Dockerfile and starting the agent is just as simple as running the container.Salohy
08/10/2021, 12:25 PMKevin Kho
pip install -e .
makes the library available to your agent whatever directory you’re in.Salohy
08/10/2021, 1:57 PMpip install -e .
in my custom Dockerfile and it worked fine. Thanks for the help guys 🙏