Heya! I’m new to prefect and am trying to deploy a...
# ask-community
j
Heya! I’m new to prefect and am trying to deploy a local agent
Copy code
prefect deployment build flows/redshift_mv_refresh.py:redshift_mv_refresh --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.
Copy code
...
    import redshift_connector
ModuleNotFoundError: No module named 'redshift_connector'
...
prefect.exceptions.ScriptError: Script at 'flows/redshift_mv_refresh.py' encountered an exception
An exception occurred.
my project’s directory
Copy code
❯ tree . -L 2
.
├── flows
│   ├── __pycache__
│   ├── lib
│   └── redshift_mv_refresh.py
├── requirements.txt
└── venv
    ├── bin
    ├── include
    ├── lib
    └── pyvenv.cfg
How can I tell
deployment build
to look for python in
Copy code
venv/bin/python
Thank you a bunch! edit: I’m using Prefect 2 with Cloud.
3
a
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
j
Thanks! Will try this with conda and report back.
👍 1
🙏 1
Looks like it is working! I’ll be using miniconda from now on! 🙂 Thank you again!