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.

Ubuntu 20.04 does not provide /usr/bin/env python

See original GitHub issue

Hi,

The latest version of the VM extension still try to call /usr/bin/env python; on Ubuntu 20.04 by default, and on the official azure images, there is no ̀python` alternatives

Error: Code="VMExtensionHandlerNonTransientError" Message="The handler for VM extension type 'Microsoft.Azure.Diagnostics.LinuxDiagnostic' has reported terminal failure for VM extension 'bastion-run-bdu1-euw-dev-vm-linux-diagnostics' with error message: '[ExtensionOperationError] Non-zero exit code: 127, /var/lib/waagent/Microsoft.Azure.Diagnostics.LinuxDiagnostic-3.0.131/diagnostic.py -install\n[stdout]\n\n\n[stderr]\nRunning scope as unit: Microsoft.Azure.Diagnostics.LinuxDiagnostic_3.0.131_e79c79ae-31f1-4d0e-a752-eec0cfcecd4c.scope\n/usr/bin/env: ‘python’: No such file or directory\n'.\r\n    \r\n'Install handler failed for the extension. More information on troubleshooting is available at https://aka.ms/VMExtensionLinuxDiagnosticsTroubleshoot'"

If we really want /usr/bin/env python have to

apt -y install python2-minimal
/usr/bin/update-alternatives --install /usr/bin/python python /usr/bin/python2 1
/usr/bin/update-alternatives --install /usr/bin/python python /usr/bin/python3 2
/usr/bin/update-alternatives --set python /usr/bin/python2

Best regards,

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:17
  • Comments:17

github_iconTop GitHub Comments

5reactions
celeroncoolcommented, Feb 8, 2022

Seriously, installing python2 while it has been EOL’d for two years is no workaround, and will break new programs which are installed on servers using python3.

Microsoft please fix.

3reactions
jeevacodeprocommented, Oct 26, 2021

Hi There, I too have the same issue. I am trying to install an upgrade from Azure monitor following the suggestions. It failed with error { "status": "Failed", "error": { "code": "VMExtensionHandlerNonTransientError", "message": "The handler for VM extension type 'Microsoft.Azure.Monitor.VirtualMachines.GuestHealth.GuestHealthLinuxAgent' has reported terminal failure for VM extension 'GuestHealthLinuxAgent' with error message: '[ExtensionOperationError] Non-zero exit code: 127, /var/lib/waagent/Microsoft.Azure.Monitor.VirtualMachines.GuestHealth.GuestHealthLinuxAgent-1.0.41/./scripts/install.py\n[stdout]\n\n\n[stderr]\nRunning scope as unit: install_<GUID>scope\n/usr/bin/env: ‘python’: No such file or directory\n'.\r\n \r\n'Install handler failed for the extension. More information on troubleshooting is available at https://aka.ms/vmextensionlinuxtroubleshoot'" } }

Any solutions or alternative.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ubuntu /usr/bin/env: python: No such file or directory
Problem scenario: /usr/bin/env: 'python': No such file or directory. Possible Solution #1. If Python 3 is not installed, install it: apt-get install python3....
Read more >
usr/bin/env: 'python': No such file or directory - Ask Ubuntu
For Ubuntu 20.04 you can use following package to python command. And it is python 3. sudo apt install python-is-python3.
Read more >
ubuntu /usr/bin/env: python: No such file or directory Ubuntu ...
Hi! This Tip Try to Solve ubuntu /usr/bin/env: python: No such file or directory in Ubuntu 20.04 Focal LTS GNU/Linux. ubuntu /usr/bin/env: ...
Read more >
How to fix Ubuntu /usr/bin/env: 'python': No such file or directory
for some scripts that want to be executed using python where only python3 is available ( python2 has long been deprecated). In order...
Read more >
usr bin env python No such file or directory - Edureka
It seems your python script is not able to find python in your system. You may have python3 installed in your system. But...
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