Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When installing providers from the context folder, use pip --find-links #15673

Merged
merged 1 commit into from
May 5, 2021

Conversation

ashb
Copy link
Member

@ashb ashb commented May 5, 2021

Without this change it is impossible for one of the providers to depend upon the "dev"/current version of Airflow -- pip instead would try and go out to PyPI to find the version (which almost certainly wont exist, as it hasn't been released yet)

This was noticed in my draft PR #15667 and caused the prod images to fail to build.

I tested this change locally with ./breeze build-image --production-image --disable-pypi-when-building --install-from-docker-context-files:

+ pip install --user --upgrade pip==21.1.1
Requirement already satisfied: pip==21.1.1 in /usr/local/lib/python3.6/site-packages (21.1.1)
WARNING: Running pip as root will break packages and permissions. You should install packages reliably by using venv: https://pip.pypa.io/warnings/venv
+ pip install --user --upgrade --upgrade-strategy only-if-needed 'apache-airflow[async,amazon,celery,cncf.kubernetes,docker,dask,elasticsearch,ftp,grpc,hashicorp,http,ldap,google,microsoft.azure,mysql,postgres,redis,sendgrid,sftp,slack,ssh,statsd,virtualenv]==2.1.0.dev0' /docker-context-files/apache_airflow_providers_amazon-1.4.0-py3-none-any.whl /docker-context-files/apache_airflow_providers_cncf_kubernetes-1.2.0-py3-none-any.whl /docker-context-files/apache_airflow_providers_docker-1.2.0-py3-none-any.whl /docker-context-files/apache_airflow_providers_elasticsearch-1.0.4-py3-none-any.whl /docker-context-files/apache_airflow_providers_ftp-1.1.0-py3-none-any.whl /docker-context-files/apache_airflow_providers_google-3.0.0-py3-none-any.whl /docker-context-files/apache_airflow_providers_microsoft_azure-2.0.0-py3-none-any.whl /docker-context-files/apache_airflow_providers_postgres-1.0.2-py3-none-any.whl /docker-context-files/apache_airflow_providers_sftp-1.2.0-py3-none-any.whl
Processing /docker-context-files/apache_airflow_providers_amazon-1.4.0-py3-none-any.whl
Processing /docker-context-files/apache_airflow_providers_cncf_kubernetes-1.2.0-py3-none-any.whl
Processing /docker-context-files/apache_airflow_providers_docker-1.2.0-py3-none-any.whl
Processing /docker-context-files/apache_airflow_providers_elasticsearch-1.0.4-py3-none-any.whl
Processing /docker-context-files/apache_airflow_providers_ftp-1.1.0-py3-none-any.whl
Processing /docker-context-files/apache_airflow_providers_google-3.0.0-py3-none-any.whl
Processing /docker-context-files/apache_airflow_providers_microsoft_azure-2.0.0-py3-none-any.whl
Processing /docker-context-files/apache_airflow_providers_postgres-1.0.2-py3-none-any.whl
Processing /docker-context-files/apache_airflow_providers_sftp-1.2.0-py3-none-any.whl
Requirement already satisfied: apache-airflow[amazon,async,celery,cncf.kubernetes,dask,docker,elasticsearch,ftp,google,grpc,hashicorp,http,ldap,microsoft.azure,mysql,postgres,redis,sendgrid,sftp,slack,ssh,statsd,virtualenv]==2.1.0.dev0 in /root/.local/lib/python3.6/site-packages (2.1.0.dev0)
...
Requirement already satisfied: zope.interface in /root/.local/lib/python3.6/site-packages (from gevent>=0.13->apache-airflow[amazon,async,celery,cncf.kubernetes,dask,docker,elasticsearch,ftp,google,grpc,hashicorp,http,ldap,microsoft.azure,mysql,postgres,redis,sendgrid,sftp,slack,ssh,statsd,virtualenv]==2.1.0.dev0) (5.4.0)
Requirement already satisfied: google-auth-oauthlib<1.0.0,>=0.0.1 in /root/.local/lib/python3.6/site-packages (from google-ads<8.0.0,>=4.0.0->apache-airflow-providers-google==3.0.0) (0.4.4)
Requirement already satisfied: googleapis-common-protos<2.0.0,>=1.5.8 in /root/.local/lib/python3.6/site-packages (from google-ads<8.0.0,>=4.0.0->apache-airflow-providers-google==3.0.0) (1.53.0)
Requirement already satisfied: grpcio<2.0.0,>=1.18.0 in /root/.local/lib/python3.6/site-packages (from google-ads<8.0.0,>=4.0.0->apache-airflow-providers-google==3.0.0) (1.37.0)
Requirement already satisfied: packaging>=14.3 in /root/.local/lib/python3.6/site-packages (from google-api-core<2.0.0,>=1.25.1->apache-airflow-providers-google==3.0.0) (20.9)
Requirement already satisfied: protobuf>=3.12.0 in /root/.local/lib/python3.6/site-packages (from google-api-core<2.0.0,>=1.25.1->apache-airflow-providers-google==3.0.0) (3.15.8)
Requirement already satisfied: httplib2<1dev,>=0.15.0 in /root/.local/lib/python3.6/site-packages (from google-api-python-client<2.0.0,>=1.6.0->apache-airflow-providers-google==3.0.0) (0.17.4)
Requirement already satisfied: uritemplate<4dev,>=3.0.0 in /root/.local/lib/python3.6/site-packages (from google-api-python-client<2.0.0,>=1.6.0->apache-airflow-providers-google==3.0.0) (3.0.1)
Requirement already satisfied: pyasn1-modules>=0.2.1 in /root/.local/lib/python3.6/site-packages (from google-auth<2.0.0,>=1.0.0->apache-airflow-providers-google==3.0.0) (0.2.8)
Requirement already satisfied: cachetools<5.0,>=2.0.0 in /root/.local/lib/python3.6/site-packages (from google-auth<2.0.0,>=1.0.0->apache-airflow-providers-google==3.0.0) (4.2.1)
Requirement already satisfied: rsa<5,>=3.1.4 in /root/.local/lib/python3.6/site-packages (from google-auth<2.0.0,>=1.0.0->apache-airflow-providers-google==3.0.0) (4.7.2)
Requirement already satisfied: requests-oauthlib>=0.7.0 in /root/.local/lib/python3.6/site-packages (from google-auth-oauthlib<1.0.0,>=0.0.1->google-ads<8.0.0,>=4.0.0->apache-airflow-providers-google==3.0.0) (1.1.0)
Requirement already satisfied: proto-plus>=1.10.0 in /root/.local/lib/python3.6/site-packages (from google-cloud-automl<3.0.0,>=2.1.0->apache-airflow-providers-google==3.0.0) (1.18.1)
Requirement already satisfied: google-cloud-core<2.0dev,>=1.4.1 in /root/.local/lib/python3.6/site-packages (from google-cloud-bigtable<2.0.0,>=1.0.0->apache-airflow-providers-google==3.0.0) (1.6.0)
Requirement already satisfied: grpc-google-iam-v1<0.13dev,>=0.12.3 in /root/.local/lib/python3.6/site-packages (from google-cloud-bigtable<2.0.0,>=1.0.0->apache-airflow-providers-google==3.0.0) (0.12.3)
Requirement already satisfied: libcst>=0.2.5 in /root/.local/lib/python3.6/site-packages (from google-cloud-datacatalog<4.0.0,>=3.0.0->apache-airflow-providers-google==3.0.0) (0.3.18)
Requirement already satisfied: google-resumable-media<2.0dev,>=1.2.0 in /root/.local/lib/python3.6/site-packages (from google-cloud-storage<2.0.0,>=1.30->apache-airflow-providers-google==3.0.0) (1.2.0)
Requirement already satisfied: google-crc32c<2.0dev,>=1.0 in /root/.local/lib/python3.6/site-packages (from google-resumable-media<2.0dev,>=1.2.0->google-cloud-storage<2.0.0,>=1.30->apache-airflow-providers-google==3.0.0) (1.1.2)
Requirement already satisfied: zipp>=0.5 in /root/.local/lib/python3.6/site-packages (from importlib-metadata~=1.7->apache-airflow[amazon,async,celery,cncf.kubernetes,dask,docker,elasticsearch,ftp,google,grpc,hashicorp,http,ldap,microsoft.azure,mysql,postgres,redis,sendgrid,sftp,slack,ssh,statsd,virtualenv]==2.1.0.dev0) (3.4.1)
Requirement already satisfied: pyrsistent>=0.14.0 in /root/.local/lib/python3.6/site-packages (from jsonschema~=3.0->apache-airflow[amazon,async,celery,cncf.kubernetes,dask,docker,elasticsearch,ftp,google,grpc,hashicorp,http,ldap,microsoft.azure,mysql,postgres,redis,sendgrid,sftp,slack,ssh,statsd,virtualenv]==2.1.0.dev0) (0.17.3)
Requirement already satisfied: certifi>=14.05.14 in /root/.local/lib/python3.6/site-packages (from kubernetes<12.0.0,>=3.0.0->apache-airflow-providers-cncf-kubernetes==1.2.0) (2020.12.5)
Requirement already satisfied: pyasn1>=0.4.6 in /root/.local/lib/python3.6/site-packages (from ldap3>=2.5.1->apache-airflow[amazon,async,celery,cncf.kubernetes,dask,docker,elasticsearch,ftp,google,grpc,hashicorp,http,ldap,microsoft.azure,mysql,postgres,redis,sendgrid,sftp,slack,ssh,statsd,virtualenv]==2.1.0.dev0) (0.4.8)
Requirement already satisfied: typing-inspect>=0.4.0 in /root/.local/lib/python3.6/site-packages (from libcst>=0.2.5->google-cloud-datacatalog<4.0.0,>=3.0.0->apache-airflow-providers-google==3.0.0) (0.6.0)
Requirement already satisfied: portalocker~=1.0 in /root/.local/lib/python3.6/site-packages (from msal-extensions~=0.3.0->azure-identity>=1.3.1->apache-airflow-providers-microsoft-azure==2.0.0) (1.7.1)
Requirement already satisfied: isodate>=0.6.0 in /root/.local/lib/python3.6/site-packages (from msrest>=0.5.0->azure-batch>=8.0.0->apache-airflow-providers-microsoft-azure==2.0.0) (0.6.0)
Requirement already satisfied: openapi-schema-validator in /root/.local/lib/python3.6/site-packages (from openapi-spec-validator>=0.2.4->connexion[flask,swagger-ui]<3,>=2.6.0->apache-airflow[amazon,async,celery,cncf.kubernetes,dask,docker,elasticsearch,ftp,google,grpc,hashicorp,http,ldap,microsoft.azure,mysql,postgres,redis,sendgrid,sftp,slack,ssh,statsd,virtualenv]==2.1.0.dev0) (0.1.5)
...
apache-airflow-providers-amazon is already installed with the same version as the provided wheel. Use --force-reinstall to force an installation of the wheel.
apache-airflow-providers-cncf-kubernetes is already installed with the same version as the provided wheel. Use --force-reinstall to force an installation of the wheel.
apache-airflow-providers-docker is already installed with the same version as the provided wheel. Use --force-reinstall to force an installation of the wheel.
apache-airflow-providers-elasticsearch is already installed with the same version as the provided wheel. Use --force-reinstall to force an installation of the wheel.
apache-airflow-providers-ftp is already installed with the same version as the provided wheel. Use --force-reinstall to force an installation of the wheel.
apache-airflow-providers-google is already installed with the same version as the provided wheel. Use --force-reinstall to force an installation of the wheel.
apache-airflow-providers-microsoft-azure is already installed with the same version as the provided wheel. Use --force-reinstall to force an installation of the wheel.
apache-airflow-providers-postgres is already installed with the same version as the provided wheel. Use --force-reinstall to force an installation of the wheel.
apache-airflow-providers-sftp is already installed with the same version as the provided wheel. Use --force-reinstall to force an installation of the wheel.

^ Add meaningful description above

Read the Pull Request Guidelines for more information.
In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.

…nks`

Without this change it is impossible for one of the providers to depend
upon the "dev"/current version of Airflow -- pip instead would try and
go out to PyPI to find the version (which almost certainly wont exist,
as it hasn't been released yet)
@ashb ashb requested a review from potiuk as a code owner May 5, 2021 13:51
@ashb
Copy link
Member Author

ashb commented May 5, 2021

/cc @uranusjr

@potiuk
Copy link
Member

potiuk commented May 5, 2021

This is strange. It should not be needed because we are installing both providers and airflow from the "/docker-context-files" directory by simply specifying them explicitely as arguments - the .whl packages for both airflow and provider should be there, built from the current sources so it should work all right.

@potiuk
Copy link
Member

potiuk commented May 5, 2021

Might be a bug in PIP @uranusjr

Just for the record and to explicitly state the problem:, the failed installation command was like below. So as far as I understand PIP should work if amazon specifies apache-airflow>=2.1.0dev and we locally have apache_airflow-2.1.0.dev0-py3-none-any.whl in the same pip install command and --find-links should not be needed. ?

pip install --user --force-reinstall '/docker-context-files/apache_airflow-2.1.0.dev0-py3-none-any.whl[async,amazon,celery,cncf.kubernetes,docker,dask,elasticsearch,ftp,grpc,hashicorp,http,ldap,google,microsoft.azure,mysql,postgres,redis,sendgrid,sftp,slack,ssh,statsd,virtualenv]' /docker-context-files/apache_airflow_providers_amazon-1.4.0.dev0-py3-none-any.whl /docker-context-files/apache_airflow_providers_celery-1.0.1.dev0-py3-none-any.whl /docker-context-files/apache_airflow_providers_cncf_kubernetes-1.2.0.dev0-py3-none-any.whl /docker-context-files/apache_airflow_providers_docker-1.2.0.dev0-py3-none-any.whl /docker-context-files/apache_airflow_providers_elasticsearch-1.0.4.dev0-py3-none-any.whl /docker-context-files/apache_airflow_providers_ftp-1.1.0.dev0-py3-none-any.whl /docker-context-files/apache_airflow_providers_google-3.0.0.dev0-py3-none-any.whl /docker-context-files/apache_airflow_providers_grpc-1.1.0.dev0-py3-none-any.whl /docker-context-files/apache_airflow_providers_hashicorp-1.0.2.dev0-py3-none-any.whl /docker-context-files/apache_airflow_providers_http-1.1.1.dev0-py3-none-any.whl /docker-context-files/apache_airflow_providers_imap-1.0.1.dev0-py3-none-any.whl /docker-context-files/apache_airflow_providers_microsoft_azure-2.0.0.dev0-py3-none-any.whl /docker-context-files/apache_airflow_providers_mysql-1.1.0.dev0-py3-none-any.whl /docker-context-files/apache_airflow_providers_postgres-1.0.2.dev0-py3-none-any.whl /docker-context-files/apache_airflow_providers_redis-1.0.1.dev0-py3-none-any.whl /docker-context-files/apache_airflow_providers_sendgrid-1.0.2.dev0-py3-none-any.whl /docker-context-files/apache_airflow_providers_sftp-1.2.0.dev0-py3-none-any.whl /docker-context-files/apache_airflow_providers_slack-3.0.0.dev0-py3-none-any.whl /docker-context-files/apache_airflow_providers_sqlite-1.0.2.dev0-py3-none-any.whl /docker-context-files/apache_airflow_providers_ssh-1.3.0.dev0-py3-none-any.whl --constraint /tmp/constraints.txt
Processing /docker-context-files/apache_airflow-2.1.0.dev0-py3-none-any.whl
Processing /docker-context-files/apache_airflow_providers_amazon-1.4.0.dev0-py3-none-any.whl
Processing /docker-context-files/apache_airflow_providers_celery-1.0.1.dev0-py3-none-any.whl
Processing /docker-context-files/apache_airflow_providers_cncf_kubernetes-1.2.0.dev0-py3-none-any.whl
Processing /docker-context-files/apache_airflow_providers_docker-1.2.0.dev0-py3-none-any.whl
Processing /docker-context-files/apache_airflow_providers_elasticsearch-1.0.4.dev0-py3-none-any.whl
Processing /docker-context-files/apache_airflow_providers_ftp-1.1.0.dev0-py3-none-any.whl
Processing /docker-context-files/apache_airflow_providers_google-3.0.0.dev0-py3-none-any.whl
Processing /docker-context-files/apache_airflow_providers_grpc-1.1.0.dev0-py3-none-any.whl
Processing /docker-context-files/apache_airflow_providers_hashicorp-1.0.2.dev0-py3-none-any.whl
Processing /docker-context-files/apache_airflow_providers_http-1.1.1.dev0-py3-none-any.whl
Processing /docker-context-files/apache_airflow_providers_imap-1.0.1.dev0-py3-none-any.whl
Processing /docker-context-files/apache_airflow_providers_microsoft_azure-2.0.0.dev0-py3-none-any.whl
Processing /docker-context-files/apache_airflow_providers_mysql-1.1.0.dev0-py3-none-any.whl
Processing /docker-context-files/apache_airflow_providers_postgres-1.0.2.dev0-py3-none-any.whl
Processing /docker-context-files/apache_airflow_providers_redis-1.0.1.dev0-py3-none-any.whl
Processing /docker-context-files/apache_airflow_providers_sendgrid-1.0.2.dev0-py3-none-any.whl
Processing /docker-context-files/apache_airflow_providers_sftp-1.2.0.dev0-py3-none-any.whl
Processing /docker-context-files/apache_airflow_providers_slack-3.0.0.dev0-py3-none-any.whl
Processing /docker-context-files/apache_airflow_providers_sqlite-1.0.2.dev0-py3-none-any.whl
Processing /docker-context-files/apache_airflow_providers_ssh-1.3.0.dev0-py3-none-any.whl

ERROR: Could not find a version that satisfies the requirement apache-airflow>=2.1.0.dev0 (from apache-airflow-providers-amazon) (from versions: 1.10.9-bin, 1.8.1, 1.8.2rc1, 1.8.2, 1.9.0, 1.10.0, 1.10.1b1, 1.10.1rc2, 1.10.1, 1.10.2b2, 1.10.2rc1, 1.10.2rc2, 1.10.2rc3, 1.10.2, 1.10.3b1, 1.10.3b2, 1.10.3rc1, 1.10.3rc2, 1.10.3, 1.10.4b2, 1.10.4rc1, 1.10.4rc2, 1.10.4rc3, 1.10.4rc4, 1.10.4rc5, 1.10.4, 1.10.5rc1, 1.10.5, 1.10.6rc1, 1.10.6rc2, 1.10.6, 1.10.7rc1, 1.10.7rc2, 1.10.7rc3, 1.10.7, 1.10.8rc1, 1.10.8, 1.10.9rc1, 1.10.9, 1.10.10rc1, 1.10.10rc2, 1.10.10rc3, 1.10.10rc4, 1.10.10rc5, 1.10.10, 1.10.11rc1, 1.10.11rc2, 1.10.11, 1.10.12rc1, 1.10.12rc2, 1.10.12rc3, 1.10.12rc4, 1.10.12, 1.10.13rc1, 1.10.13, 1.10.14rc1, 1.10.14rc2, 1.10.14rc3, 1.10.14rc4, 1.10.14, 1.10.15rc1, 1.10.15, 2.0.0b1, 2.0.0b2, 2.0.0b3, 2.0.0rc1, 2.0.0rc2, 2.0.0rc3, 2.0.0, 2.0.1rc1, 2.0.1rc2, 2.0.1, 2.0.2rc1, 2.0.2)
ERROR: No matching distribution found for apache-airflow>=2.1.0.dev0
WARNING: You are using pip version 21.1; however, version 21.1.1 is available.

Copy link
Member

@potiuk potiuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, The only question I have is why it did not work in the first place :)?

@github-actions github-actions bot added the full tests needed We need to run full set of tests for this PR to merge label May 5, 2021
@github-actions
Copy link

github-actions bot commented May 5, 2021

The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest master at your convenience, or amend the last commit of the PR, and push it with --force-with-lease.

@ashb
Copy link
Member Author

ashb commented May 5, 2021

I suspect that by providing .whl feels it bypasses some part of the resolver, and thus doesn't notice that it's already "got" the 2.1.0dev0 of Airflow available.

@ashb ashb merged commit 13faa69 into apache:master May 5, 2021
@ashb ashb deleted the prod-providers-use-find-links branch May 5, 2021 15:25
@uranusjr
Copy link
Member

uranusjr commented May 5, 2021

IIRC there is some kind of ordering involved, if you provide the wheel path before all packages depending on it[1] pip will work as expected. But installing from path is generally frawned upon anyway (it’s a non-standard pip extension) and we generally advice --find-links regardless.

[1]: something like that, I don’t recall the exact details from the top of my head. One of the other pip maintainers likens the process to put your left hand on your head and turn right three times and sacrafice the heart of a goat.

@potiuk
Copy link
Member

potiuk commented May 5, 2021

Cool. Thanks for clarification!

@potiuk
Copy link
Member

potiuk commented May 5, 2021

Yeah the goat was definitely missing here.

potiuk pushed a commit to potiuk/airflow that referenced this pull request May 6, 2021
…nks` (apache#15673)

Without this change it is impossible for one of the providers to depend
upon the "dev"/current version of Airflow -- pip instead would try and
go out to PyPI to find the version (which almost certainly wont exist,
as it hasn't been released yet)

(cherry picked from commit 13faa69)
@potiuk potiuk added this to the Airflow 2.0.3 milestone May 9, 2021
@ashb ashb modified the milestones: Airflow 2.0.3, Airflow 2.1 May 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:dev-tools full tests needed We need to run full set of tests for this PR to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants