Open nm419 opened 1 month ago
Hello, @nm419! I'm here to help you with your issue. Let's work together to get it sorted out.
To resolve the error with DbtRunVirtualenvOperator
when using ExecutionMode.VIRTUALENV
in Astronomer Cosmos 1.7.0 on MWAA, ensure the following:
Ensure virtualenv
is Installed: The error indicates that the virtualenv
package might not be found. Make sure virtualenv==20.26.3
is included in your requirements.txt
and properly installed in your Airflow environment.
Set py_requirements
: Ensure you specify the required Python packages in py_requirements
. For example:
operator_args={
"py_system_site_packages": False,
"py_requirements": ["dbt-athena-community==1.8.3"],
"install_deps": True,
}
Check virtualenv_dir
: Ensure the virtualenv_dir
is correctly set and accessible. If it's temporary, ensure it is created and managed properly.
Verify Python Path: The error log shows an attempt to execute a command using Python 3.7. Ensure that the correct Python version is being used and that the path to the virtualenv
script is correct.
Lock Handling: Ensure that the virtual environment lock is managed correctly to avoid conflicts.
If these steps do not resolve the issue, further investigation into the specific error message and logs would be necessary. The error suggests a potential misconfiguration or missing dependencies in your setup [1][2].
To continue talking to Dosu, mention @dosu.
hi @nm419 , just wish to check if this was due to a change introduced in the latest release of Cosmos 1.7. Could you please try once with an earlier version astronomer-cosmos==1.6.0
and see if you still get that error?
Hi @pankajkoti , I have updated my requirements with astronomer-cosmos==1.6.0 and the same error has occurred.
Astronomer Cosmos Version
Other Astronomer Cosmos version (please specify below)
If "Other Astronomer Cosmos version" selected, which one?
1.7.0
dbt-core version
1.8.5
Versions of dbt adapters
dbt-athena-community==1.8.3
LoadMode
AUTOMATIC
ExecutionMode
VIRTUALENV
InvocationMode
None
airflow version
2.10.1
Operating System
Ubuntu 20.04.6 LTS
If a you think it's an UI issue, what browsers are you seeing the problem on?
No response
Deployment
Amazon (AWS) MWAA
Deployment details
No response
What happened?
Upgraded our MWAA env to 2.10.1 and reviewed our requirements.txt to upgrade the relevant packages. Upgraded astronomer-cosmos from 1.5.1 to 1.7.0. Attempted to follow the https://github.com/astronomer/astronomer-cosmos/blob/main/dev/dags/example_virtualenv.py example dag as we previously used the ExecutionMode.VIRTUALENV and it has changed since 1.6.0 (by the looks of it).
Relevant log output
How to reproduce
export DBT_VENV_PATH="${AIRFLOW_HOME}/dbt_venv"
export PIP_USER=false
export PIP_USER=true
export DAGS_HOME="${AIRFLOW_HOME}/dags"
export DBT_EXECUTABLE_PATH="${DBT_VENV_PATH}/bin/dbt"
export AWS_DEFAULT_REGION='ap-southeast-2'
export AIRFLOWCOSMOSDBT_DOCS_CONN_ID="aws_default"
`
--constraint "https://raw.githubusercontent.com/apache/airflow/constraints-2.10.1/constraints-3.11.txt"
airflow-dbt-python==2.1.0 airflow-provider-great-expectations==0.2.7 apache-airflow-providers-amazon==8.28.0 apache-airflow-providers-apprise==1.4.0 apache-airflow-providers-atlassian-jira==2.7.0 apache-airflow-providers-microsoft-mssql==3.9.0 apache-airflow-providers-openlineage==1.11.0 apache-airflow-providers-oracle==3.11.0 apache-airflow-providers-postgres==5.12.0 apache-airflow-providers-sftp==4.11.0 apache-airflow-providers-tableau==4.6.0 astronomer-cosmos==1.7.0 awswrangler[openpyxl]==3.9.0 dbt-athena-community==1.8.4 dbt-core==1.8.7 dbt-postgres==1.8.2 email-validator==2.2.0 geopandas==1.0.1 geoalchemy2==0.14.1 jira==3.6.0 loguru==0.7.2 Office365-REST-Python-Client==2.5.9 openpyxl==3.1.5 pyarrow==14.0.2 pydantic==2.8.2 pydantic-settings==2.1.0 pyogrio==0.7.2 pytest==8.3.2 python-benedict==0.33.1 schema==0.7.5 virtualenv==20.26.3 xxhash==3.4.1 protobuf < 5.26.0
Anything else :)?
Not sure if i have something incorrectly set up but the following code seems to work when running with ExecutionMode.LOCAL> Not sure if I should just go with that or because we're running on MWAA we should continue to use Virtualenv.
My dag.py file:
Are you willing to submit PR?
Contact Details
nickmalandris@gmail.com