I was also facing the same error when I was trying to upload numpy , tensorflow and other libraries for my training task, I wasnt able to solve the problem so what I did was I just ran the pip install commands as a task in my dag. Also the version compatibility is also handled by pip
Here is the code:
Import sys
Import subprocess
@task
def installing_dependencies_using_subprocess():
subprocess.check_call(
[sys.executable, "-m", "pip", "install", "numpy"])
subprocess.check_call(
[sys.executable, "-m", "pip", "install", "pandas"])
subprocess.check_call(
[sys.executable, "-m", "pip", "install", "seaborn"])
subprocess.check_call(
[sys.executable, "-m", "pip", "install", "scikit-learn"])
subprocess.check_call(
[sys.executable, "-m", "pip", "install", "tensorflow"])
subprocess.check_call(
[sys.executable, "-m", "pip", "install", "joblib"])
subprocess.check_call(
[sys.executable, "-m", "pip", "install", "matplotlib"])
subprocess.check_call(
[sys.executable, "-m", "pip", "install", "s3fs"])
return {"message": "Dependencies installed successfully"}