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

{CI} Fix Python wheels Test #27102

Merged
merged 5 commits into from
Aug 17, 2023
Merged

{CI} Fix Python wheels Test #27102

merged 5 commits into from
Aug 17, 2023

Conversation

bebound
Copy link
Contributor

@bebound bebound commented Aug 7, 2023

Description

In this PR, I change the command to install the wheel directly, to make sure it does not install package from pypi


When releasing 2.51.0, Test Python Wheels fails with this error:

ERROR: Package 'azure-cli' requires a different Python: 3.7.16 not in '>=3.8.0'

That's expected, as 2.51 does not support 3.7. I'm curious why this test does not find this error earlier.

In fact, pip install -f /mnt/pypi -q azure-cli==$CLI_VERSION.* never runs as expected.

This command add /mnt/pypi into search path, and try to install azure-cli==$CLI_VERSION.*. It has two problem:

  1. /mnt/pypi does not have higher priority, if pypi contains the specific version, it may install from pypi instead of local

pip looks for packages in a number of places: on PyPI (if not disabled via --no-index), in the local filesystem, and in any additional repositories specified via --find-links or --index-url. There is no ordering in the locations that are searched. Rather they are all checked, and the “best” match for the requirements (in terms of version number - see PEP 440 for details) is selected. --https://pip.pypa.io/en/stable/cli/pip_install/#finding-packages

  1. $CLI_VERSION.* includes $CLI_VERSION, which can be found from pypi.

Here is the log in python 3.7. I guess it tries to install local version first, which is not compatible with 3.7, then install 2.50 from pypi.

pip install -f /down/az install azure-cli==2.50.0.* --no-cache-dir --no-deps
Looking in links: /down/az
Requirement already satisfied: install in /usr/local/lib/python3.7/site-packages (1.3.5)
Processing ./azure_cli-2.50.0.post20230726073400-py3-none-any.whl
Collecting azure-cli==2.50.0.*
  Downloading azure_cli-2.50.0-py3-none-any.whl (11.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 11.6/11.6 MB 9.9 MB/s eta 0:00:00
Installing collected packages: azure-cli
Successfully installed azure-cli-2.50.0

Here is the log for 3.8. It successfully installs the local wheel.

root@a95e41ea4477:/down/az# pip install -f /down/az install azure-cli==2.50.0.* --no-cache-dir --no-deps
Looking in links: /down/az
Collecting install
  Downloading install-1.3.5-py3-none-any.whl (3.2 kB)
Processing ./azure_cli-2.50.0.post20230726073400-py3-none-any.whl
Installing collected packages: install, azure-cli
Successfully installed azure-cli-2.50.0.post20230726073400 install-1.3.5

@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Aug 7, 2023

️✔️AzureCLI-FullTest
️✔️acr
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️acs
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️advisor
️✔️latest
️✔️3.10
️✔️3.9
️✔️ams
️✔️latest
️✔️3.10
️✔️3.9
️✔️apim
️✔️latest
️✔️3.10
️✔️3.9
️✔️appconfig
️✔️latest
️✔️3.10
️✔️3.9
️✔️appservice
️✔️latest
️✔️3.10
️✔️3.9
️✔️aro
️✔️latest
️✔️3.10
️✔️3.9
️✔️backup
️✔️latest
️✔️3.10
️✔️3.9
️✔️batch
️✔️latest
️✔️3.10
️✔️3.9
️✔️batchai
️✔️latest
️✔️3.10
️✔️3.9
️✔️billing
️✔️latest
️✔️3.10
️✔️3.9
️✔️botservice
️✔️latest
️✔️3.10
️✔️3.9
️✔️cdn
️✔️latest
️✔️3.10
️✔️3.9
️✔️cloud
️✔️latest
️✔️3.10
️✔️3.9
️✔️cognitiveservices
️✔️latest
️✔️3.10
️✔️3.9
️✔️config
️✔️latest
️✔️3.10
️✔️3.9
️✔️configure
️✔️latest
️✔️3.10
️✔️3.9
️✔️consumption
️✔️latest
️✔️3.10
️✔️3.9
️✔️container
️✔️latest
️✔️3.10
️✔️3.9
️✔️core
️✔️2018-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️cosmosdb
️✔️latest
️✔️3.10
️✔️3.9
️✔️databoxedge
️✔️2019-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️dla
️✔️latest
️✔️3.10
️✔️3.9
️✔️dls
️✔️latest
️✔️3.10
️✔️3.9
️✔️dms
️✔️latest
️✔️3.10
️✔️3.9
️✔️eventgrid
️✔️latest
️✔️3.10
️✔️3.9
️✔️eventhubs
️✔️latest
️✔️3.10
️✔️3.9
️✔️feedback
️✔️latest
️✔️3.10
️✔️3.9
️✔️find
️✔️latest
️✔️3.10
️✔️3.9
️✔️hdinsight
️✔️latest
️✔️3.10
️✔️3.9
️✔️identity
️✔️latest
️✔️3.10
️✔️3.9
️✔️iot
️✔️2019-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️keyvault
️✔️2018-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️kusto
️✔️latest
️✔️3.10
️✔️3.9
️✔️lab
️✔️latest
️✔️3.10
️✔️3.9
️✔️managedservices
️✔️latest
️✔️3.10
️✔️3.9
️✔️maps
️✔️latest
️✔️3.10
️✔️3.9
️✔️marketplaceordering
️✔️latest
️✔️3.10
️✔️3.9
️✔️monitor
️✔️latest
️✔️3.10
️✔️3.9
️✔️mysql
️✔️latest
️✔️3.10
️✔️3.9
️✔️netappfiles
️✔️latest
️✔️3.10
️✔️3.9
️✔️network
️✔️2018-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️policyinsights
️✔️latest
️✔️3.10
️✔️3.9
️✔️privatedns
️✔️latest
️✔️3.10
️✔️3.9
️✔️profile
️✔️latest
️✔️3.10
️✔️3.9
️✔️rdbms
️✔️latest
️✔️3.10
️✔️3.9
️✔️redis
️✔️latest
️✔️3.10
️✔️3.9
️✔️relay
️✔️latest
️✔️3.10
️✔️3.9
️✔️resource
️✔️2018-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️role
️✔️latest
️✔️3.10
️✔️3.9
️✔️search
️✔️latest
️✔️3.10
️✔️3.9
️✔️security
️✔️latest
️✔️3.10
️✔️3.9
️✔️servicebus
️✔️latest
️✔️3.10
️✔️3.9
️✔️serviceconnector
️✔️latest
️✔️3.10
️✔️3.9
️✔️servicefabric
️✔️latest
️✔️3.10
️✔️3.9
️✔️signalr
️✔️latest
️✔️3.10
️✔️3.9
️✔️sql
️✔️latest
️✔️3.10
️✔️3.9
️✔️sqlvm
️✔️latest
️✔️3.10
️✔️3.9
️✔️storage
️✔️2018-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️synapse
️✔️latest
️✔️3.10
️✔️3.9
️✔️telemetry
️✔️2018-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️util
️✔️latest
️✔️3.10
️✔️3.9
️✔️vm
️✔️2018-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9

@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Aug 7, 2023

️✔️AzureCLI-BreakingChangeTest
️✔️Non Breaking Changes

@ghost ghost added Auto-Assign Auto assign by bot CI CI labels Aug 7, 2023
@yonzhan
Copy link
Collaborator

yonzhan commented Aug 7, 2023

CI

@bebound bebound changed the title {CI} Fix Python wheels test {CI} Fix Python wheels Test Aug 14, 2023
@jiasli
Copy link
Member

jiasli commented Aug 16, 2023

Why is the log not in English but Azerbaijani?

Linklərdə axtarış edilir: /down/az

@@ -449,12 +449,12 @@ jobs:
echo "== Testing pip install on Python 3.9 =="
docker run \
--rm -v $PYPI_FILES:/mnt/pypi python:3.9 \
/bin/bash -c "ls /mnt/pypi && pip install -f /mnt/pypi -q azure-cli==$CLI_VERSION.* && az self-test && az --version && sleep 5"
Copy link
Member

Choose a reason for hiding this comment

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

The test for Python 3.7 was removed by #27015.

.* was initially added by 4baa9d8 from #16362.

I made a test on the built artifact and noticed * is not expanded by the shell if no matching file exists:

$ curl https://artprodwus21.artifacts.visualstudio.com/A7b238909-6802-4b65-b90d-184bca47f458/5147fa83-336e-44ef-bbe0-c86b8ae86cbb/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6Y2xpdG9vbHMvcHJvamVjdElkLzUxNDdmYTgzLTMzNmUtNDRlZi1iYmUwLWM4NmI4YWU4NmNiYi9idWlsZElkLzgyNDg5L2FydGlmYWN0TmFtZS9weXBp0/content?format=zip -o pypi.zip
$ unzip pypi.zip
$ cd pypi
$ echo azure-*
azure-cli-2.51.0.post20230815081512.tar.gz azure-cli-core-2.51.0.post20230815081512.tar.gz azure-cli-telemetry-1.1.0.post20230815081512.tar.gz
$ CLI_VERSION=2.51.0
$ echo azure-cli==$CLI_VERSION.*
azure-cli==2.51.0.*

Since #27001, 2.50.0.post* on the local disk is not compatible with Python 3.7, so pip falls back to a compatible version 2.50.0 from PyPI.

@@ -449,12 +449,12 @@ jobs:
echo "== Testing pip install on Python 3.9 =="
docker run \
--rm -v $PYPI_FILES:/mnt/pypi python:3.9 \
/bin/bash -c "ls /mnt/pypi && pip install -f /mnt/pypi -q azure-cli==$CLI_VERSION.* && az self-test && az --version && sleep 5"
/bin/bash -c "cd /mnt/pypi && ls && pip install -f ./ azure_cli-$CLI_VERSION*whl && az self-test && az --version && sleep 5"
Copy link
Member

Choose a reason for hiding this comment

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

Why cd into /mnt/pypi? Is -f ./ still necessary now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't want to write full path in -f and whl file.

Yes, the azure_cli-$CLI_VERSION*whl requires azure-cli-core-XX.post, we need to add this folder into additional repositories.

@@ -449,12 +449,12 @@ jobs:
echo "== Testing pip install on Python 3.9 =="
docker run \
--rm -v $PYPI_FILES:/mnt/pypi python:3.9 \
/bin/bash -c "ls /mnt/pypi && pip install -f /mnt/pypi -q azure-cli==$CLI_VERSION.* && az self-test && az --version && sleep 5"
/bin/bash -c "cd /mnt/pypi && ls && pip install -f ./ azure_cli-$CLI_VERSION*whl && az self-test && az --version && sleep 5"
Copy link
Member

@jiasli jiasli Aug 16, 2023

Choose a reason for hiding this comment

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

If we force it to install the whl packages, there will be no need to care about $CLI_VERSION. I guess we may simply use azure_cli*.whl to install all local wheels:

Suggested change
/bin/bash -c "cd /mnt/pypi && ls && pip install -f ./ azure_cli-$CLI_VERSION*whl && az self-test && az --version && sleep 5"
/bin/bash -c "cd /mnt/pypi && ls && pip install azure_cli*.whl && az self-test && az --version && sleep 5"

This will include

$ echo azure_cli*.whl
azure_cli-2.51.0.post20230815081512-py3-none-any.whl
azure_cli_core-2.51.0.post20230815081512-py3-none-any.whl
azure_cli_telemetry-1.1.0.post20230815081512-py3-none-any.whl

Copy link
Contributor Author

Choose a reason for hiding this comment

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

pip install azure_cli*.whl also works, but I want to make this test command close to the real scenario: pip install azure-cli.

@bebound
Copy link
Contributor Author

bebound commented Aug 17, 2023

Why is the log not in English but Azerbaijani?

Linklərdə axtarış edilir: /down/az

My OpenAI Translator extension is triggered unexpectedly.
The last two lines are its prompt Please translate this text into Azerbaijani language, without explaining the sentences, just translate them as they are. After 2.51, it is not compatible with native wheel 3.7 and there is no 2.51 on pypi, which creates an error "Package 'azure-cli' requires a different Python: 3.7.16'>= 3.8.0'"

Bu mətni Azərbaycan dilinə tərcümə edin, zəhmət olmasa cümlələri izah etməyin, sadəcə tərcümə edin və ya onları olduğu kimi qoyun.```
2.51-dən sonra yerli çark 3.7 ilə uyğun deyil və pypi-da 2.51 yoxdur, bu `Paket 'azure-cli' fərqli bir Python tələb edir: 3.7.16 '>= 3.8.0' deyil` səhvi yaradır.

@@ -449,12 +449,12 @@ jobs:
echo "== Testing pip install on Python 3.9 =="
docker run \
--rm -v $PYPI_FILES:/mnt/pypi python:3.9 \
/bin/bash -c "ls /mnt/pypi && pip install -f /mnt/pypi -q azure-cli==$CLI_VERSION.* && az self-test && az --version && sleep 5"
/bin/bash -c "cd /mnt/pypi && ls && pip install --find-links ./ azure_cli-$CLI_VERSION*whl && az self-test && az --version && sleep 5"
Copy link
Member

@jiasli jiasli Aug 17, 2023

Choose a reason for hiding this comment

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

It'll be good practice to always make * match as little as possible:

Suggested change
/bin/bash -c "cd /mnt/pypi && ls && pip install --find-links ./ azure_cli-$CLI_VERSION*whl && az self-test && az --version && sleep 5"
/bin/bash -c "cd /mnt/pypi && ls && pip install --find-links ./ azure_cli-*-py3-none-any.whl && az self-test && az --version && sleep 5"

@bebound bebound merged commit ce28461 into Azure:dev Aug 17, 2023
54 checks passed
@bebound bebound deleted the fix-wheel-test branch August 17, 2023 06:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants