I'm getting some weird behavior regarding modules. I can correctly import my flow and the Config class from
projects
from both Python and Jupyter Notebook:
Copy code
from projects.example.flows.hello_world
from projects import Config
But when I run the same import from Prefect, I get the following error:
Copy code
pipenv run prefect run -m projects.example.flows.hello_world
No module named 'projects'
a
Anna Geller
04/20/2022, 2:58 PM
Check out this Discourse topic for explanation of the issue and some ways you can solve it
🙌 1
k
Kevin Kho
04/20/2022, 2:58 PM
Is that projects pip installed? You need it to be to use
-m
j
Jason
04/20/2022, 3:02 PM
Yup - so when I use pipenv run prefect run -p dir/dir/file.py I also get:
ModuleNotFoundError: No module named 'projects'
. It's just weird because usually I don't need to bother with a setup.py. As long as the directory is modularized with an init.py I can usually import.
k
Kevin Kho
04/20/2022, 3:03 PM
That is to import and use in a script, which can work if the relative path is right but it won’t work in all paths. I think the execution path of the
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.