`az --version` fails with SyntaxError on Python 3
See original GitHub issueDescription
az --version
fails with SyntaxError on Python 3 due to Python 2 only library futures
being installed.
Installing azure-cli 2.0.10 with pip on Python 3.6.1 produces this output. Importantly, these lines appear:
Collecting futures (from azure-multiapi-storage==0.1.0->azure-cli-vm->azure-cli)
Downloading futures-3.1.1.tar.gz
Subsequently, operations in that environment that require pip will fail when compileall
, which imports concurrent
, is imported. For example:
$ PYTHONPATH=/opt/azure python -c "import pip"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/opt/azure/pip/__init__.py", line 28, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "/opt/azure/pip/vcs/subversion.py", line 9, in <module>
from pip.index import Link
File "/opt/azure/pip/index.py", line 31, in <module>
from pip.wheel import Wheel, wheel_ext
File "/opt/azure/pip/wheel.py", line 6, in <module>
import compileall
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/compileall.py", line 20, in <module>
from concurrent.futures import ProcessPoolExecutor
File "/opt/azure/concurrent/futures/__init__.py", line 8, in <module>
from concurrent.futures._base import (FIRST_COMPLETED,
File "/opt/azure/concurrent/futures/_base.py", line 381
raise exception_type, self._exception, self._traceback
^
SyntaxError: invalid syntax
A similar traceback will appear with az --version
when it imports pip.
Futures declares that it’s Python 2 only, so shouldn’t be installed on Python 3.
Environment summary
Install Method: How did you install the CLI? (e.g. pip, interactive script, apt-get, Docker, MSI, nightly)
Answer here: pip
CLI Version: What version of the CLI and modules are installed? (Use az --version
)
Answer here: 2.0.10
OS Version: What OS and version are you using?
Answer here: macOS 10.12.5
Shell Type: What shell are you using? (e.g. bash, cmd.exe, Bash on Windows)
Answer here: zsh
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (2 by maintainers)
Top GitHub Comments
I was able to work around the issue by manually removing the
concurrent
package and then uninstallingfutures
.@afelthe, Azure CLI has dropped support for Python 2 (https://github.com/Azure/azure-cli/pull/11363). Are you using the latest Azure CLI?