VOOZH about

URL: https://repost.aws/questions/QUza4fRo7GS7GOkS6L80ttLw/not-able-to-install-snowflake-connector-python-package-in-mwaa

⇱ Not able to install snowflake-connector-python package in MWAA | AWS re:Post


Skip to content

Not able to install snowflake-connector-python package in MWAA

0

I am using MWAA 2.10.1 version and this is the requirement file i am using and it was throwing a error while importing the dag by stating that the "No module named snowflake". Could you please suggest what I can do to resolve this issue?? This is my requirements.txt file content: pyarrow filelock platformdirs pydantic virtualenv distlib snowflake-connector-python snowflake-sqlalchemy astronomer-cosmos apache-airflow[snowflake]==2.10.1 apache-airflow-providers-snowflake==6.1.0

2 Answers
  • Newest
  • Most votes
  • Most comments
Are these answers helpful? Upvote the correct answer to help the community benefit from your knowledge.
0

My MWAA environment is private and it wont be able to read the constraint file from internet, could you please let me know the other way around?

answered a year ago

-2
This recommendation was generated using AWS Generative AI capabilities. You are responsible for evaluating the recommendation in your specific context and implementing appropriate oversight and safeguards. Learn more
This answer has not been reviewed by an expert

To resolve the issue of not being able to install the snowflake-connector-python package in Amazon Managed Workflows for Apache Airflow (MWAA) 2.10.1, there are a few steps you can take:

  1. Ensure you're using the correct constraint file: For MWAA 2.10.1, you need to include a constraint statement in your requirements.txt file. This ensures compatibility between the packages and the Apache Airflow version. Add the following line at the beginning of your requirements.txt file:

--constraint "https://raw.githubusercontent.com/apache/airflow/constraints-2.10.1/constraints-3.10.txt"

  1. Specify package versions: It's a best practice to specify versions for all packages in your requirements.txt file. This helps prevent conflicts and ensures consistency. Update your file to include specific versions for each package.

  2. Order of installation: The order of packages in the requirements.txt file can sometimes affect installation. Try moving the snowflake-related packages to the top of the list, right after the constraint statement.

  3. Remove redundant packages: Since you're installing apache-airflow[snowflake], you may not need to separately specify snowflake-connector-python and snowflake-sqlalchemy, as they should be included as dependencies.

  4. Test locally: Before deploying to MWAA, test your requirements file using the MWAA local runner. This can help identify any conflicts or issues before deployment.

  5. Check CloudWatch Logs: After updating and deploying your requirements.txt file, check the CloudWatch Logs for the requirements installation process. This can provide more detailed error information if the installation is still failing.

  6. Verify in Airflow UI: After a successful installation, you can verify the installed packages in the Airflow UI under the "Providers" section.

If you're still encountering issues after these steps, you may need to create a .zip archive of all dependencies and upload it to your S3 bucket, specifying the package location in your MWAA configuration.

Remember to redeploy your MWAA environment after making changes to the requirements.txt file for the changes to take effect.

Sources
Amazon MWAA frequently asked questions - Amazon Managed Workflows for Apache Airflow
Amazon MWAA best practices for managing Python dependencies | AWS Big Data Blog

answered a year ago

  • My MWAA environment is private and it wont be able to read the constraint file from internet, could you please let me know the other way around?