Azure-cli: pip install of previous version is now broken

Created on 8 Jan 2018  路  9Comments  路  Source: Azure/azure-cli

Somehow older version(s) of az are now broken for pip install:

$ python3 -m venv venv
$ . ./venv/bin/activate
$ pip install azure-cli 2.0.23
...
$ az --version
Traceback (most recent call last):
  File "/usr/local/Cellar/python3/3.6.4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/local/Cellar/python3/3.6.4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/private/tmp/venv/lib/python3.6/site-packages/azure/cli/__main__.py", line 9, in <module>
    import azure.cli.main
  File "/private/tmp/venv/lib/python3.6/site-packages/azure/cli/main.py", line 9, in <module>
    from azure.cli.core import configure_logging, get_az_logger
ImportError: cannot import name 'configure_logging'

Perhaps something in az core wasn't pinned to an explicit version, so we're pulling in a new, incompatible one accidentally?

This makes coming up with a workaround for #5218 difficult.

PackaginPip

Most helpful comment

pip install azure-cli==2.0.23 would still pull down the latest of everything else as all the command modules are separate packages.

You should be able to install like this:

pip install -r https://gist.githubusercontent.com/derekbekoe/4e60d38f6243ab60cff41ad269cbf0ba/raw/aa7caf587892cc08d6ca3cb7cb85f7dc4b798cfa/azure-cli-2.0.23.txt

That worked for me.

This is how I created the requirements file if you're wondering:

docker run -it azuresdk/azure-cli-python:2.0.23
pip freeze > requirements.txt

All 9 comments

pip install azure-cli==2.0.23 would still pull down the latest of everything else as all the command modules are separate packages.

You should be able to install like this:

pip install -r https://gist.githubusercontent.com/derekbekoe/4e60d38f6243ab60cff41ad269cbf0ba/raw/aa7caf587892cc08d6ca3cb7cb85f7dc4b798cfa/azure-cli-2.0.23.txt

That worked for me.

This is how I created the requirements file if you're wondering:

docker run -it azuresdk/azure-cli-python:2.0.23
pip freeze > requirements.txt

Closing as the above should address your issue and it never worked that way to begin with.

@derekbekoe understood, I just hadn't realized pip install azure-cli wasn't officially supported, but now that I re-read our install docs I see we don't mention pip install. We must have gotten lucky up until now. :-)

Yeah pip install azure-cli works best for the 'latest' CLI version.
The requirements.txt may be a solution for you if you still want to install with pip.

It would be good if pip worked that way as for example there seems to be no other way to install 2.0.23 into Stretch using a Dockerfile, the apt-get method has a clash with .Net Core CLI with openssl versions.

I've just created a repo with the past versions: https://github.com/OSSCanada/azure-cli-requirements

We've run workshops where the latest version has broken some commands...

@raykao By chance do you have more recent requirements for newer versions, such as 2.0.27, 2.0.28, and 2.0.29, and do you intend to keep publishing version requirements to the above repo?

Or is the approach outlined above by @derekbekoe the recommended way to get the version requirements:

docker run -it azuresdk/azure-cli-python:<insert version here>
pip freeze > requirements.txt

It seems that azuresdk/azure-cli-python is missing versions 2.0.27 and 2.0.28.

We now publish versioned Docker images to microsoft/azure-cli.

https://hub.docker.com/r/microsoft/azure-cli/tags/

@derekbekoe thanks for the clarification. Doing pip freeze works for getting the requirements with microsoft/azure-cli in case others may be wondering about requirements for specific versions.

Was this page helpful?
0 / 5 - 0 ratings