Having installed azure-cli via homebrew I get the following python errors whenever I try and run a command. e.g. if I perform az login, or az --help, or other commands I get the following errors:-
$ az login
field 6 out of range (need a 48-bit value)
Traceback (most recent call last):
File "/usr/local/Cellar/azure-cli/2.0.23/libexec/lib/python3.6/site-packages/azure/cli/main.py", line 36, in main
cmd_result = APPLICATION.execute(args)
File "/usr/local/Cellar/azure-cli/2.0.23/libexec/lib/python3.6/site-packages/azure/cli/core/application.py", line 141, in execute
self.refresh_request_id()
File "/usr/local/Cellar/azure-cli/2.0.23/libexec/lib/python3.6/site-packages/azure/cli/core/application.py", line 269, in refresh_request_id
self.session['headers']['x-ms-client-request-id'] = str(uuid.uuid1())
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/uuid.py", line 606, in uuid1
clock_seq_hi_variant, clock_seq_low, node), version=1)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/uuid.py", line 168, in __init__
raise ValueError('field 6 out of range (need a 48-bit value)')
ValueError: field 6 out of range (need a 48-bit value)
Install Method (e.g. pip, interactive script, apt-get, Docker, MSI, edge build) / CLI version (az --version) / OS version / Shell Type (e.g. bash, cmd.exe, Bash on Windows)
I installed via home-brew, having initially tried to install using the curl method, however this failed to build. The home-brew version installed fine, but just doesn't work.
$ az --version
azure-cli (2.0.23)
acr (2.0.17)
acs (2.0.22)
advisor (0.1.0)
appservice (0.1.22)
backup (1.0.3)
batch (3.1.7)
batchai (0.1.3)
billing (0.1.6)
cdn (0.0.10)
cloud (2.0.10)
cognitiveservices (0.1.9)
command-modules-nspkg (2.0.1)
configure (2.0.12)
consumption (0.2.0)
container (0.1.15)
core (2.0.23)
cosmosdb (0.1.15)
dla (0.0.15)
dls (0.0.18)
eventgrid (0.1.5)
extension (0.0.6)
feedback (2.0.6)
find (0.2.7)
interactive (0.3.11)
iot (0.1.15)
keyvault (2.0.15)
lab (0.0.13)
monitor (0.0.13)
network (2.0.19)
nspkg (3.0.1)
profile (2.0.16)
rdbms (0.0.9)
redis (0.2.10)
reservations (0.1.0)
resource (2.0.19)
role (2.0.15)
servicefabric (0.0.7)
sql (2.0.17)
storage (2.0.21)
vm (2.0.20)
Python location '/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6'
Extensions directory '/Users/markread/.azure/cliextensions'
Python (Darwin) 3.6.4 (v3.6.4:d48ecebad5, Dec 18 2017, 21:07:28)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]
Legal docs and information: aka.ms/AzureCliLegal
Running into the same issue here. This looks related to uuid.py from the python framework getting a 64 bit hardware address for the loopback adapter in High Sierra, specifically in _ifconfig_getnode(). The function expects a 48 bit mac address, but is instead getting 64 bits back and converting it to an int value that is too long for the subsequent call in uuid.py.
This is a sample output of the call to ifconfig that is being parsed:
b'lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384\n'
b'\toptions=1203<RXCSUM,TXCSUM,TXSTATUS,SW_TIMESTAMP>\n'
b'\tinet 127.0.0.1 netmask 0xff000000 \n'
b'\tinet6 ::1 prefixlen 128 \n'
b'\tlladdr 70:cd:60:ff:ab:cd:ef:12 \n'
As you can see, the lladdr is longer than the usual 48 bit mac address. This issue should ideally be addressed in the uuid.py module from the python project.
I've created an issue in bugs.python.org for this: https://bugs.python.org/issue32502
+1
Did anyone find a solution?
@derekbekoe, ty for the linkup to this ticket, sir. I missed this open status in my initial search. Any findings, I shall post back here.
If anyone has steps to reproduce, it would help us provide a fix for this.
Same issue here. This blocks all our automated script and make impossible to work on Azure.
My output for az login is:
field 6 out of range (need a 48-bit value)
Traceback (most recent call last):
File "/usr/local/Cellar/azure-cli/2.0.27/libexec/lib/python3.6/site-packages/knack/cli.py", line 194, in invoke
cmd_result = self.invocation.execute(args)
File "/usr/local/Cellar/azure-cli/2.0.27/libexec/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 200, in execute
args = _pre_command_table_create(self.cli_ctx, args)
File "/usr/local/Cellar/azure-cli/2.0.27/libexec/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 101, in _pre_command_table_create
cli_ctx.refresh_request_id()
File "/usr/local/Cellar/azure-cli/2.0.27/libexec/lib/python3.6/site-packages/azure/cli/core/__init__.py", line 67, in refresh_request_id
self.data['headers']['x-ms-client-request-id'] = str(uuid.uuid1())
File "/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/uuid.py", line 606, in uuid1
clock_seq_hi_variant, clock_seq_low, node), version=1)
File "/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/uuid.py", line 168, in __init__
raise ValueError('field 6 out of range (need a 48-bit value)')
ValueError: field 6 out of range (need a 48-bit value)
macOS High Sierra 10.13.3
Python 3.6.4 (default, Jan 6 2018, 11:51:59)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] on darwin
Python and Azure cli installed with Homebrew.
Output of azure --version is:
azure-cli (2.0.27)
acr (2.0.21)
acs (2.0.26)
advisor (0.1.2)
appservice (0.1.26)
backup (1.0.6)
batch (3.1.10)
batchai (0.1.5)
billing (0.1.7)
cdn (0.0.13)
cloud (2.0.12)
cognitiveservices (0.1.10)
command-modules-nspkg (2.0.1)
configure (2.0.14)
consumption (0.2.1)
container (0.1.18)
core (2.0.27)
cosmosdb (0.1.19)
dla (0.0.18)
dls (0.0.19)
eventgrid (0.1.10)
extension (0.0.9)
feedback (2.1.0)
find (0.2.8)
interactive (0.3.16)
iot (0.1.17)
keyvault (2.0.18)
lab (0.0.17)
monitor (0.1.2)
network (2.0.23)
nspkg (3.0.1)
profile (2.0.19)
rdbms (0.0.12)
redis (0.2.11)
reservations (0.1.1)
resource (2.0.23)
role (2.0.19)
servicefabric (0.0.10)
sql (2.0.21)
storage (2.0.25)
vm (2.0.26)
Python location '/usr/local/opt/python3/bin/python3.6'
Extensions directory '/Users/gordon/.azure/cliextensions'
Python (Darwin) 3.6.4 (default, Jan 6 2018, 11:51:59)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)]
Legal docs and information: aka.ms/AzureCliLegal
@derekbekoe
I suggest to mock the uuid call in a unit test to reproduce, as per https://bugs.python.org/issue32502 seems related to a new minor release of High Sierra and the network interface hardware. So, my guess is that there is no simple way to reproduce.
Currently the upstream Python issue has been fixed and merged ([1]). Unfortunately a new 3.6 release (3.6.5) is not due until the end of March 2018 ([2]).
A risky workaround is possible manually substituting the uuid.py module in your local installation of Python 3.6.4.
uuid.py from the approved PR: https://raw.githubusercontent.com/bbayles/cpython/d4b98dff3441c79fb7c2af9149b96f819d0c81ab/Lib/uuid.py/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6;uuid.py: cp uuid.py uuid.py.orig;cp /your/download/path/uuid.py ./uuid.py;az login and other az should now works as expected).Created a PR that will switch to uuid4 if uuid1 raises the ValueError.
Most helpful comment
Currently the upstream Python issue has been fixed and merged ([1]). Unfortunately a new 3.6 release (3.6.5) is not due until the end of March 2018 ([2]).
Workaround for Python 3.6.4
A risky workaround is possible manually substituting the
uuid.pymodule in your local installation of Python 3.6.4.uuid.pyfrom the approved PR: https://raw.githubusercontent.com/bbayles/cpython/d4b98dff3441c79fb7c2af9149b96f819d0c81ab/Lib/uuid.py/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6;uuid.py:cp uuid.py uuid.py.orig;cp /your/download/path/uuid.py ./uuid.py;az loginand otherazshould now works as expected).