question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No module named '__builtin__' in Ubuntu 20.04 (Canonical image)

See original GitHub issue

Describe the bug

I was trying to install the OmsAgentForLinux and enablevmaccess extensions in Ubuntu 20.04 via CLI.

Command Name az vm extension image list

Errors:

No module named '__builtin__'
Traceback (most recent call last):
python3/dist-packages/knack/cli.py, ln 206, in invoke
    cmd_result = self.invocation.execute(args)
cli/core/commands/__init__.py, ln 528, in execute
    self.commands_loader.load_arguments(command)
azure/cli/core/__init__.py, ln 300, in load_arguments
    loader.load_arguments(command)  # this adds entries to the argument registries
cli/command_modules/vm/__init__.py, ln 31, in load_arguments
    from azure.cli.command_modules.vm._params import load_arguments
...
dist-packages/antlr4/error/Errors.py, ln 5, in <module>
    from antlr4.atn.Transition import PredicateTransition
dist-packages/antlr4/atn/Transition.py, ln 19, in <module>
    from __builtin__ import unicode
ModuleNotFoundError: No module named '__builtin__'

To Reproduce:

Steps to reproduce the behavior. Tried any and all of the following:

  • sudo apt install azure-cli
    • “/usr/lib/python3/dist-packages/azure/cosmos/session.py:186: SyntaxWarning: “is not” with a literal. Did you mean “!=”? if session_token is not ‘’:”
  • az vm extension image list --location eastus --output table
    • “ModuleNotFoundError: No module named ‘antlr4’”
  • sudo apt install python3-pip
  • sudo pip3 install antlr4-python2-runtime
  • az vm extension image list --location westus --output table
    • “ModuleNotFoundError: No module named ‘__builtin__’”
  • pip3 install future
  • az vm extension image list --location westus --output table
    • “ModuleNotFoundError: No module named ‘__builtin__’”
  • Rinse, repeat

Expected Behavior

  • It would be nice if Azure supported backups of Ubuntu 20.04
  • It would be nice if the CLI worked in Ubuntu 20.04

Environment Summary

Linux-5.4.0-1010-azure-x86_64-with-glibc2.29
Python 3.8.2
Shell: bash

azure-cli 2.0.81 *

Extensions:
azure-devops 0.17.0

Additional Context

I installed Ubuntu 20.04 from a public image (Ubuntu Server 20.04 LTS - Canonical) since there appears to be no official one (?), but when I tried to enable backups, I keep getting:

Could not communicate with the VM agent for snapshot status - Snapshot VM sub task timed out

Looking under Extensions in Portal, it says “OmsAgentForLinux (unavailable)”. It seems that I have no resort but to create a new instance with 18.04 and reproduce the tedium of re-configuring and migrating everything, but I thought that I would share this failure because the CLI recommended az feedback. I tried using the CLI to install the missing extensions (since they are inexplicably absent when I click “Add” extension from Portal).

I imagine that this will be #wontfix’d as a Canonical or Python issue, but here it is for posterity.

  • I am not an expert of the following: Azure, Python, azure-cli
  • I imagine that switching to Python 2 might have an impact, but I have run out of time trying to get the CLI to work.

EDIT: Repeating these steps with Python 2 yielded the same errors, and now it is recommending that I retry on Saturday:

Screen-Shot-2020-05-15-at-3 02 45-PM

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
jkendzorracommented, May 25, 2020

Here’s a workaround for those willing to use pip3: sudo pip3 install antlr4-python3-runtime (from https://golder.org/azure-cli-cant-find-antlr4-python-library/)

1reaction
fengzhou-msftcommented, May 26, 2020

The azure-cli package that comes with the Focal universe repo is a bit old and has some issues. A new Focal package is just released for azure-cli 2.6.0. Please follow https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-apt?view=azure-cli-latest to try again.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No module named builtins - python - Stack Overflow
When I execute the setup file below using "python setup.py py2exe" it gives me an executable but when I run it, it complains...
Read more >
ImportError: No module named builtins - Ask Ubuntu
Solved a similar error in a separate situation by installing the package future . sudo pip install future. It's not clear if your...
Read more >
SoundTroubleshootingProcedure - Community Help Wiki
You may want to follow this guide to gather essential troubleshooting information about your sound card. This information will be useful in ...
Read more >
MmPbSaStat.py issue - Google Groups
from builtins import range ImportError: No module named builtins. Please help. Thanks & Regards Sanket Ghawali. Nikhil M's profile photo ...
Read more >
Switching between Python 2 and 3 versions on Ubuntu 20.04
Ubuntu 18.04 LTS release came with several changes, and one is that Python 2 was no longer the default Python version in the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found