09/18/2022, 5:41 PM
Heya! I’m new to prefect and am trying to deploy a local agent
prefect deployment build flows/ --name JPMBP-O --queue JPMBP-O --tag "redshift mv-refresh test" --infra process
However I’m running into an issue where the
deployment build
command tests the main flow and hence fails as it can not import some of the modules provided by a virtual env.
    import redshift_connector
ModuleNotFoundError: No module named 'redshift_connector'
prefect.exceptions.ScriptError: Script at 'flows/' encountered an exception
An exception occurred.
my project’s directory
❯ tree . -L 2
├── flows
│   ├── __pycache__
│   ├── lib
│   └──
├── requirements.txt
└── venv
    ├── bin
    ├── include
    ├── lib
    └── pyvenv.cfg
How can I tell
deployment build
to look for python in
Thank you a bunch! edit: I’m using Prefect 2 with Cloud.

Anna Geller

09/18/2022, 7:06 PM
Venv is a bit weird, can you try the same in a Conda environment? You would need to ensure your agent gets deployed to the same virtual environment as the one you used to run your flows locally Generally, this redshift connector module seems missing in your execution layer


09/18/2022, 8:11 PM
Thanks! Will try this with conda and report back.
👍 1
:thank-you: 1
Looks like it is working! I’ll be using miniconda from now on! 🙂 Thank you again!