<@ULVA73B9P> I am able to deploy a flow to my work...
# ask-marvin
r
@Marvin I am able to deploy a flow to my work pool on Prefect Managed Infrastructure. I have configured my work pool with the necessary requirements, and have verified that the module is installed when my flow starts, but I still get this error:
Copy code
Encountered exception during execution: Exception('Error importing snowflake-connector-python. Please install it manually.')
Traceback (most recent call last):
  File "/opt/prefect/nil_etl-prefect_deployment/src/flows/snowflake.py", line 54, in snowflake
    import snowflake.connector
ModuleNotFoundError: No module named 'snowflake.connector'
m
thought for 31.7 seconds
This error suggests that despite your requirements configuration, the Snowflake connector isn't being installed correctly. Here are the specific steps to resolve this: 1. Check Your Requirements Format The package name in your requirements should be exactly
snowflake-connector-python
. Make sure you're not using just
snowflake
or another variant. 2. Dependencies Snowflake connector often needs additional dependencies. Update your work pool requirements to include:
Copy code
snowflake-connector-python
   cryptography
3. Version Specification If you're still having issues, try specifying an exact version:
Copy code
snowflake-connector-python==3.0.0
(Replace 3.0.0 with your desired version) 4. Verify Installation Add a simple print statement at the start of your flow to verify the package version:
Copy code
python
   import pkg_resources
   print(pkg_resources.get_distribution('snowflake-connector-python').version)
5. Alternative Import If you're still experiencing issues, you can try adding a pre-command to your work pool configuration:
Copy code
pip install --upgrade snowflake-connector-python
If these steps don't resolve the issue, you might want to: 1. Check if there are any conflicts with other packages in your requirements 2. Verify that your work pool has sufficient permissions to install packages 3. Consider using a custom Docker image with Snowflake pre-installed Would you mind sharing your current requirements configuration from your work pool? That would help me provide more specific guidance.
j
I believe this is because your file is named
snowflake.py
which causes an import conflict with the snowflake package
r
ah yes. I actually ran into that once before haha. thanks!
🙌 1
j
I honestly do this once a month with something or other...
r
Yeah, I ran into it with this exact code because I ran it in a different context. It normally doesn't happen, I think because I usually test locally with
python3 -m src.flows.snowflake
which maybe helps me accidentally evade that.