https://prefect.io logo
#prefect-community
Title
# prefect-community
z

Zachary Loertscher

12/07/2022, 4:22 PM
Hi all, I need to run a flow which runs a stored procedure on a SQL Server 2017 instance (which is hosted on AWS) using the python package
pyodbc
However, I continue to get the error
Failed to load and execute flow run: ModuleNotFoundError("No module named 'pyodbc'")
I have.. • added
pyodbc
to requirements.txt, which is installed using our
Dockerfile
with
RUN pip install -r requirements.txt
Info: Prefect version: 1.2.4 Deployment: AWS CDK for AWS Where does your docker container live?: an ECS Fargate deployment. What OS runs on your docker container? Amazon Linux 2 Any ideas? Is Prefect just not finding the package?
1️⃣ 1
m

Mason Menges

12/08/2022, 7:44 PM
Hey @Zachary Loertscher Were you able to sort this out? When you updated the Image did you also re-register the flow? In theory if your just using Latest for the image this may not matter but it's worth mentioning for the sake of argument Ultimately it sounds like the flow may not be running the correct container if you've built the new image and deployed it thus why that error would be displaying. It could also be a Path issue in the Image but that seems unlikely
z

Zachary Loertscher

12/08/2022, 7:51 PM
@Mason Menges Unfortunately I haven't figured it out yet. Yeah, the flow was re-registered. How does the flow interact with the image? Is that something I could configure for a
UniversalRun
? Also, not sure if it matters, but this is running via a Local Agent that gets booted up from the
dockerfile
m

Mason Menges

12/08/2022, 8:08 PM
Hmm Thinking out loud, Essentially that means when the agents submits the flow run it's running as a local process within the agent when you register the flow it's going to assume the "path" to the flow/modules is based on where it was registered from, i.e. the local path for where this was developed, could try setting the path through an environment variable in the docker image prior to installing the requirements. https://docs-v1.prefect.io/core/concepts/configuration.html#environment-variable-interpolation, short version it might just be that wherever the module is getting installed prefect can't find it based on the path it's looking for it in I think. All that said you could also have the agent running separately in a virtual machine and use dockerrun to specify the image the flow needs to run with, if this is through AWS you should be able to push the image to an ECR registry and access it there. Or you could use Local Storage and store that actual flow code within the Docker Image and run it that way https://discourse.prefect.io/t/mounting-volume-to-dockerrun-for-local-storage/722
6 Views