Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean install of CLI on OpenSUSE 15 gives error: NotImplementedError: APIVersion 2019-06-01 is not available #13209

Open
rsponholtz opened this issue Apr 27, 2020 · 34 comments

Comments

@rsponholtz
Copy link
Member

This is autogenerated. Please review and update as needed.

Describe the bug

Created brand-new OpenSUSE 15.1 VM, Installed CLI as per instructions here:

https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-zypper?view=azure-cli-latest

az login

gives error:
Error loading command module 'aro': No module named 'azure.mgmt.redhatopenshift'
details below:

Command Name
az login

Errors:

APIVersion 2019-06-01 is not available
Traceback (most recent call last):
python3.6/site-packages/knack/cli.py, ln 215, in invoke
    cmd_result = self.invocation.execute(args)
cli/core/commands/__init__.py, ln 631, in execute
    raise ex
cli/core/commands/__init__.py, ln 695, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
cli/core/commands/__init__.py, ln 688, in _run_job
    six.reraise(*sys.exc_info())
...
azure/cli/core/_profile.py, ln 844, in find_through_interactive_flow
    result = self._find_using_common_tenant(token_entry[_ACCESS_TOKEN], resource)
azure/cli/core/_profile.py, ln 877, in _find_using_common_tenant
    tenants = client.tenants.list()
mgmt/resource/subscriptions/subscription_client.py, ln 122, in tenants
    raise NotImplementedError("APIVersion {} is not available".format(api_version))
NotImplementedError: APIVersion 2019-06-01 is not available

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

Expected Behavior

CLI should login to my Azure account/subscription

Environment Summary

Linux-4.12.14-lp151.28.7-default-x86_64-with-glibc2.3.4
Python 3.6.5
Installer: RPM

azure-cli 2.4.0

Additional Context

@yonzhan yonzhan added this to the S170 milestone Apr 27, 2020
@yonzhan
Copy link
Collaborator

yonzhan commented Apr 27, 2020

@fengzhou-msft please take a look

@yungezz yungezz modified the milestones: S170, S171 Apr 28, 2020
@balaji-suse
Copy link

I just created a SLES 15 SP1 PAYG VM. I ran into same error.

@Praveen-410
Copy link

Praveen-410 commented May 19, 2020

My customer is using a Centos redhat base and they are getting the same error.

@poblahblahblah
Copy link

Seeing this as well.

@magaal
Copy link
Member

magaal commented May 19, 2020

+1 on Ubuntu

@fengzhou-msft
Copy link
Member

fengzhou-msft commented May 26, 2020

It seems OpenSUSE 15.1 VM comes with a very old version of azure cli (2.0.45). It has a bunch of old azure-cli-* module packages and old dependencies installed in the system python site-packages directory(/usr/lib/python3.6/site-packages). With newer versions of azure-cli, all the modules are consolidated into one azure-cli package and all dependecies are installed under /usr/lib64/az/lib/python3.6/site-packages to not share the dependencies on purpose. The old dependencies was loaded and caused issues.

If you haven't installed other python packages, the easiest way to clean up these old azure-cli packages and dependencies is to sudo zypper remove python3 and sudo rm -rf /usr/lib/python3.6/site-packages. Then you can run sudo zypper install --from azure-cli azure-cli to install the latest azure-cli and its dependencies including python3.

@jiasli
Copy link
Member

jiasli commented May 27, 2020

I can repro this issue on openSUSE Leap 15.1. We actually saw this issue before in #12783, #12878, #12779 and mistook it for some pip installation problem.

This is the pre-installed Azure CLI on openSUSE Leap 15.1:

> az -v
azure-cli (2.0.45)

acr (2.1.4)
acs (2.3.2)
...
Python location '/usr/bin/python3'
Extensions directory '/home/jladmin/.azure/cliextensions'

Python (Linux) 3.6.5 (default, Mar 31 2018, 19:45:04) [GCC]

Legal docs and information: aka.ms/AzureCliLegal

We have two options here:

1. Contact openSUSE to remove the pre-installed Azure CLI

Since openSUSE Leap 15.1 is not maintained by Microsoft, we need to contact openSUSE to remove the pre-installed Azure CLI to avoid all kinds of problems. Moreover, it can probably cause other problems once we move to PEP 420 (#13293).

image

2. Ship Azure CLI with its own Python

After installing Azure CLI with zypper, we can run

jladmin@jlsuse:~> az -v
azure-cli                          2.6.0

acr                                2.1.4
acs                                2.3.2
...

Python location '/usr/bin/python3'

We can see Azure CLI is using the system /usr/bin/python3 on openSUSE, it may conflicts with the pre-installed packages. We can ship Azure CLI with its own Python like how we do on Ubuntu with a deb package.

@jiasli
Copy link
Member

jiasli commented May 27, 2020

+1 on Ubuntu

@magaal, the Azure CLI package on Ubuntu has a built-in Python, which shouldn't suffer from this issue. After installing Azure CLI with apt:

$ az -v
azure-cli                          2.6.0

Python location '/opt/az/bin/python3'

You can see the Python Azure CLI uses is /opt/az/bin/python3.

To help us analysis this issue, could you share

  1. The image and version of your Ubuntu
  2. How you installed Azure CLI

@jiasli
Copy link
Member

jiasli commented May 27, 2020

The reason why directly running sudo zypper install --from azure-cli azure-cli doesn't work is because the empty /usr/lib/python3.6/site-packages/azure/__init__.py makes Python treat azure as a regular package, and thus stop using /usr/lib64/az/lib/python3.6/site-packages/azure which is assigned in the az script:

> which az
/usr/bin/az

> cat /usr/bin/az
#!/usr/bin/env bash
AZ_INSTALLER=RPM PYTHONPATH=/usr/lib64/az/lib/python3.6/site-packages /usr/bin/python3 -sm azure.cli "$@"

https://www.python.org/dev/peps/pep-0420/#specification

If <directory>/foo/__init__.py is found, a regular package is imported and returned.

@fengzhou-msft
Copy link
Member

fengzhou-msft commented Jul 1, 2020

It seems OpenSUSE 15.1 VM comes with a very old version of azure cli (2.0.45). It has a bunch of old azure-cli-* module packages and old dependencies installed in the system python site-packages directory(/usr/lib/python3.6/site-packages). With newer versions of azure-cli, all the modules are consolidated into one azure-cli package and all dependecies are installed under /usr/lib64/az/lib/python3.6/site-packages to not share the dependencies on purpose. The old dependencies was loaded and caused issues.

If you haven't installed other python packages, the easiest way to clean up these old azure-cli packages and dependencies is to sudo zypper remove python3 and sudo rm -rf /usr/lib/python3.6/site-packages. Then you can run sudo zypper install --from azure-cli azure-cli to install the latest azure-cli and its dependencies including python3.

If you have other Python applications installed, you can use the follwoing workaround:
First, install back the old azure-cli that comes with the VM image:
sudo zypper install --oldpackage azure-cli-2.0.45-4.22.noarch
This way zypper knows what packages the old azure-cli depends on, then remove the old azure-cli and its dependencies:
sudo zypper rm -y --clean-deps azure-cli
Finally, follow the doc to install the latest azure-cli:
https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-zypper?view=azure-cli-latest

We're also reaching out to the team that builds the image to either upgrade or remove the old azure-cli.

@sakanamax
Copy link

sakanamax commented Sep 6, 2020

@fengzhou-msft Thanks for the information
OS: openSUSE Leap 15.2

The old package in Main repo name should use azure-cli-2.0.45-lp152.2.2
# zypper install -y --oldpackage azure-cli-2.0.45-lp152.2.2

but if openSUSE user use pip3 to install ansible with Azure ( https://docs.ansible.com/ansible/latest/scenario_guides/guide_azure.html)
# pip3 install ansible[azure]

after we clean dependencies and install new azure-cli, ansible command doesn't work anymore :p

@davidmichelfonseca
Copy link

I'm experiencing this issue on openSUSE Tumbleweed when I try to login with 'az login':

Error loading command module 'aro': No module named 'azure.mgmt.redhatopenshift'

@fengzhou-msft
Copy link
Member

@DataRepository are you able to run az --version to check your version? Does the instruction work for you?

@sakanamax
Copy link

@fengzhou-msft
OS: openSUSE Leap 15.2

After ansible 2.10, azure module move to external collections
ansible azure module use " #ansible-galaxy collection install azure.azcollection "

I try to install azure-cli first (clean openSUSE Leap 15.2, not install any python package)

when I run

az --version

/usr/bin/python3: No module named azure.cli.main; 'azure.cli' is a package and cannot be directly executed

like #8716

@glaubitz
Copy link

glaubitz commented Jun 9, 2021

It seems OpenSUSE 15.1 VM comes with a very old version of azure cli (2.0.45). It has a bunch of old azure-cli-* module packages and old dependencies installed in the system python site-packages directory(/usr/lib/python3.6/site-packages). With newer versions of azure-cli, all the modules are consolidated into one azure-cli package and all dependecies are installed under /usr/lib64/az/lib/python3.6/site-packages to not share the dependencies on purpose. The old dependencies was loaded and caused issues.

The newer packages are all available in openSUSE Leap 15.2 and 15.3 now ship version 2.14.2. Same applies to SLE-15-SP1 and newer.

Packaging the Azure SDK and CLI packages for a distributions is rather tricky due to the unusual high number of component packages.

Plus, the Azure SDK and CLI are apparently developed by different teams at a different development pace such that there are sometimes incompatibilities between SDK and CLI packages unless distribution packagers pick the right version of the SDK component packages.

FWIW, I am responsible for the Azure SDK and CLI packaging in openSUSE and SLE and such issues should be reported to the SUSE Bugzilla.

@yonzhan yonzhan added this to the S189 milestone Jun 12, 2021
@yonzhan yonzhan modified the milestones: S189, Jul 2021 (2021-08-03) Jul 1, 2021
@jiasli jiasli modified the milestones: Jul 2021 (2021-08-03), Backlog Jul 8, 2021
@sakanamax
Copy link

OS: openSUSE Leap 15.3

Still have problem when install azure-cli
#zypper install -y curl &&
rpm --import https://packages.microsoft.com/keys/microsoft.asc &&
zypper addrepo --name 'Azure CLI' --check https://packages.microsoft.com/yumrepos/azure-cli azure-cli &&
zypper install --from azure-cli -y azure-cli

when finish install and run
#az --version
get error with

/usr/bin/python3.6: No module named azure.cli.main; 'azure.cli' is a package and cannot be directly executed

@jiasli jiasli changed the title clean install of CLI on OpenSUSE 15 gives error Clean install of CLI on OpenSUSE 15 gives error: NotImplementedError: APIVersion 2019-06-01 is not available Dec 27, 2021
@jiasli
Copy link
Member

jiasli commented Dec 27, 2021

@sakanamax, this is different from the original NotImplementedError issue. Let's work on #20839 instead.

@glaubitz
Copy link

OS: openSUSE Leap 15.3

Still have problem when install azure-cli #zypper install -y curl && rpm --import https://packages.microsoft.com/keys/microsoft.asc && zypper addrepo --name 'Azure CLI' --check https://packages.microsoft.com/yumrepos/azure-cli azure-cli && zypper install --from azure-cli -y azure-cli

when finish install and run #az --version get error with

/usr/bin/python3.6: No module named azure.cli.main; 'azure.cli' is a package and cannot be directly executed

You shouldn't mix Azure packages from different sources. In particular, you are installing packages created for Fedora/RHEL on an openSUSE system. If you want the latest RPM packages on openSUSE, you can install them from the Cloud:Tools and devel:languages:python:azure and devel:languages:python:backports packages.

@sakanamax
Copy link

@glaubitz Any document on openSUSE wiki for install Azure CLI ?

"you can install them from the Cloud:Tools and devel:languages:python:azure and devel:languages:python:backports packages."
Or could you give us a guide or example to install ? Thanks

@glaubitz
Copy link

glaubitz commented Jan 4, 2022

You can just install azure-cli with zypper in azure-cli which will install the older version. An update to a newer version is currently pending in our internal maintenance system.

To install the latest versions azure-cli on SLE-12/SLE-15/Leap 15.3, you can add the repos with:

zypper addrepo https://download.opensuse.org/repositories/Cloud:Tools/openSUSE_Leap_15.2/Cloud:Tools.repo
zypper addrepo https://download.opensuse.org/repositories/devel:languages:python:azure/openSUSE_Leap_15.2/devel:languages:python:azure.repo
zypper addrepo https://download.opensuse.org/repositories/devel:languages:python:azure/openSUSE_Leap_15.2/devel:languages:python:backports.repo
zypper refresh
zypper install azure-cli

But you can also make sure that your azure-cli package has the proper conflicts with the existing Azure packages in openSUSE if you want to allow users to install the RPMs that you are providing.

@sakanamax
Copy link

Hi @glaubitz the repo is for 15.2? according to the URL (https://download.opensuse.org/repositories/Cloud:Tools/openSUSE_Leap_15.2/Cloud:Tools.repo)
I think that is the one of the reasons - people don't choose this repo -- install azure-cli with openSUSE Leap 15.3
Because openSUSE Leap 15.2 is End of Life.

Any plan or date for newer version azure-cli with openSUSE Leap 15.3 ? ( An update to a newer version is currently pending in our internal maintenance system. )

Again, thanks for help

@glaubitz
Copy link

glaubitz commented Jan 5, 2022

Hi @glaubitz the repo is for 15.2? according to the URL (https://download.opensuse.org/repositories/Cloud:Tools/openSUSE_Leap_15.2/Cloud:Tools.repo) I think that is the one of the reasons - people don't choose this repo -- install azure-cli with openSUSE Leap 15.3 Because openSUSE Leap 15.2 is End of Life.

The 15.2 repository can be used with 15.3 without any problems.

Any plan or date for newer version azure-cli with openSUSE Leap 15.3 ? ( An update to a newer version is currently pending in our internal maintenance system. )

I will enable repository builds for 15.3 as well.

Again, thanks for help

Sure, no problem. Feel free to report any issues with the Azure package directly to our Bugzilla in case you run into any problems.

@sakanamax
Copy link

Hi @glaubitz

OS: openSUSE Leap 15.3

Thanks for enable repository builds for 15.3

I try to install with these command

#zypper install ansible
#ansible-galaxy collection install azure.azcollection

#zypper addrepo https://download.opensuse.org/repositories/Cloud:/Tools/15.3/Cloud:Tools.repo
#zypper addrepo https://download.opensuse.org/repositories/devel:/languages:/python:/azure/15.3/devel:languages:python:azure.repo

#zypper refresh
#zypper install azure-cli

I got error message blow

Problem: nothing provides 'azure-cli-core = 2.31.0' needed by the to be installed azure-cli-2.31.0-lp153.81.1.noarch
Solution 1: do not install azure-cli-2.31.0-lp153.81.1.noarch
Solution 2: break azure-cli-2.31.0-lp153.81.1.noarch by ignoring some of its dependencies

Choose from above solutions by number or cancel [1/2/c/d/?] (c):

By the way ....

There is no " devel:languages:python:backports.repo " in https://download.opensuse.org/repositories/devel:/languages:/python:/azure/15.3/

  • So I can not use zypper addrepo

Any idea about this ?

Thanks for kindly help

@glaubitz
Copy link

Thanks for enable repository builds for 15.3

I try to install with these command

#zypper install ansible
#ansible-galaxy collection install azure.azcollection

#zypper addrepo https://download.opensuse.org/repositories/Cloud:/Tools/15.3/Cloud:Tools.repo
#zypper addrepo https://download.opensuse.org/repositories/devel:/languages:/python:/azure/15.3/devel:languages:python:azure.repo

#zypper refresh
#zypper install azure-cli

I got error message blow

Problem: nothing provides 'azure-cli-core = 2.31.0' needed by the to be installed azure-cli-2.31.0-lp153.81.1.noarch Solution 1: do not install azure-cli-2.31.0-lp153.81.1.noarch Solution 2: break azure-cli-2.31.0-lp153.81.1.noarch by ignoring some of its dependencies

Choose from above solutions by number or cancel [1/2/c/d/?] (c):

I will have a look at that and fix the issue, if there is any.

By the way ....

There is no " devel:languages:python:backports.repo " in https://download.opensuse.org/repositories/devel:/languages:/python:/azure/15.3/

* So I can not use zypper addrepo

Any idea about this ?

The .repo file is now there, not sure why you didn't see it earlier. 15.3 is definitely enabled for this repo:

https://build.opensuse.org/repositories/devel:languages:python:backports

@sakanamax
Copy link

Hi @glaubitz
Thanks for quick reply

Becasue I saw your reply at 2022/1/4

#zypper addrepo https://download.opensuse.org/repositories/devel:languages:python:azure/openSUSE_Leap_15.2/devel:languages:python:backports.repo

and change path to https://download.opensuse.org/repositories/devel:/languages:/python:/azure/15.3/ , there is no backports
But according to your last reply, path should be
https://download.opensuse.org/repositories/devel:/languages:/python:/backports/15.3/

I will try later, thanks for kindly help

@sakanamax
Copy link

I already add backport repo, but still see the same message

# zypper lr
Repository priorities are without effect. All enabled repositories share the same priority.

#  | Alias                            | Name                                                                                        | Enabled | GPG Check | Refresh
---+----------------------------------+---------------------------------------------------------------------------------------------+---------+-----------+--------
 1 | Cloud_Tools                      | Cloud:Tools (15.3)                                                                          | Yes     | (r ) Yes  | No
 2 | devel_languages_python_azure     | Development project for MS Azure python infrastructure (15.3)                               | Yes     | (r ) Yes  | No
 3 | devel_languages_python_backports | Backport builds of Python Modules (15.3)                                                    | Yes     | (r ) Yes  | No
 4 | repo-backports-debug-update      | Update repository with updates for openSUSE Leap debuginfo packages from openSUSE Backports | No      | ----      | ----
 5 | repo-backports-update            | Update repository of openSUSE Backports                                                     | Yes     | (r ) Yes  | Yes
 6 | repo-debug                       | Debug Repository                                                                            | No      | ----      | ----
 7 | repo-debug-non-oss               | Debug Repository (Non-OSS)                                                                  | No      | ----      | ----
 8 | repo-debug-update                | Update Repository (Debug)                                                                   | No      | ----      | ----
 9 | repo-debug-update-non-oss        | Update Repository (Debug, Non-OSS)                                                          | No      | ----      | ----
10 | repo-non-oss                     | Non-OSS Repository                                                                          | Yes     | (r ) Yes  | Yes
11 | repo-oss                         | Main Repository                                                                             | Yes     | (r ) Yes  | Yes
12 | repo-sle-debug-update            | Update repository with debuginfo for updates from SUSE Linux Enterprise 15                  | No      | ----      | ----
13 | repo-sle-update                  | Update repository with updates from SUSE Linux Enterprise 15                                | Yes     | (r ) Yes  | Yes
14 | repo-source                      | Source Repository                                                                           | No      | ----      | ----
15 | repo-update                      | Main Update Repository                                                                      | Yes     | (r ) Yes  | Yes
16 | repo-update-non-oss              | Update Repository (Non-Oss)                                                                 | Yes     | (r ) Yes  | Yes

# zypper install azure-cli
Loading repository data...
Reading installed packages...
Resolving package dependencies...

Problem: nothing provides 'azure-cli-core = 2.31.0' needed by the to be installed azure-cli-2.31.0-lp153.81.1.noarch
 Solution 1: do not install azure-cli-2.31.0-lp153.81.1.noarch
 Solution 2: break azure-cli-2.31.0-lp153.81.1.noarch by ignoring some of its dependencies

Choose from above solutions by number or cancel [1/2/c/d/?] (c): 

@glaubitz
Copy link

glaubitz commented Feb 1, 2022

I already add backport repo, but still see the same message

There was a remaining issue with the 15.3 repositories that I have fixed now.

I have verified on a test VM with openSUSE Leap 15.3 now that installation works with these repos added for 15.3:

devel:languages:python:azure
devel:languages:python:backports
Cloud:Tools

@sakanamax
Copy link

Hi @glaubitz
thanks for reply

OS: openSUSE Leap 15.3

# zypper install ansible
# ansible-galaxy collection install azure.azcollection
# zypper addrepo https://download.opensuse.org/repositories/Cloud:/Tools/15.3/Cloud:Tools.repo
# zypper addrepo https://download.opensuse.org/repositories/devel:/languages:/python:/azure/15.3/devel:languages:python:azure.repo
# zypper addrepo https://download.opensuse.org/repositories/devel:/languages:/python:/backports/15.3/devel:languages:python:backports.repo
# zypper refresh
# zypper install azure-cli
Loading repository data...
Reading installed packages...
Resolving package dependencies...

Problem: the to be installed azure-cli-2.32.0-lp153.82.1.noarch requires 'python3-PyNaCl >= 1.4.0', but this requirement cannot be provided
  not installable providers: python3-PyNaCl-1.5.0-lp153.2.5.x86_64[devel_languages_python_backports]
 Solution 1: do not install azure-cli-2.32.0-lp153.82.1.noarch
 Solution 2: break azure-cli-2.32.0-lp153.82.1.noarch by ignoring some of its dependencies

Choose from above solutions by number or cancel [1/2/c/d/?] (c): 

Still bad luck with installation

Thanks again for kindly help

@glaubitz
Copy link

glaubitz commented Feb 1, 2022

Hi @glaubitz thanks for reply

OS: openSUSE Leap 15.3
(...)
Still bad luck with installation

Thanks again for kindly help

Packages are being rebuilt from time to time. python-PyNaCl has not been published in the repository after a rebuild now:

https://build.opensuse.org/package/show/devel:languages:python:backports/python-PyNaCl

image

The truck icon means it has been published, the gear means it's being processed.

@sakanamax
Copy link

@glaubitz Got it

I will retry it after the package is ready :)

Thanks again

@sakanamax
Copy link

Hi @glaubitz
I did the installation this morning but still bad luck.

# zypper install ansible
# ansible-galaxy collection install azure.azcollection
# zypper addrepo https://download.opensuse.org/repositories/Cloud:/Tools/15.3/Cloud:Tools.repo
# zypper addrepo https://download.opensuse.org/repositories/devel:/languages:/python:/azure/15.3/devel:languages:python:azure.repo
# zypper addrepo https://download.opensuse.org/repositories/devel:/languages:/python:/backports/15.3/devel:languages:python:backports.repo
# zypper refresh
# zypper install azure-cli
Loading repository data...
Reading installed packages...
Resolving package dependencies...

Problem: the to be installed azure-cli-2.32.0-lp153.82.1.noarch requires 'python3-PyNaCl >= 1.4.0', but this requirement cannot be provided
  not installable providers: python3-PyNaCl-1.5.0-lp153.2.5.x86_64[devel_languages_python_backports]
 Solution 1: do not install azure-cli-2.32.0-lp153.82.1.noarch
 Solution 2: break azure-cli-2.32.0-lp153.82.1.noarch by ignoring some of its dependencies

Choose from above solutions by number or cancel [1/2/c/d/?] (c): 

@sakanamax
Copy link

Hi @glaubitz
Any news about python3-PyNaCl ?
Thanks

@sakanamax
Copy link

I think we cloud close this issue? Because Azure say not support openSUSE / SUSE after 2.39.0 ?
https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-linux?pivots=zypper
@glaubitz
thanks everyone for take care this issue

@glaubitz
Copy link

glaubitz commented Jan 2, 2023

azure-cli works in openSUSE Tumbleweed and is soon going to be updated in openSUSE 15.x. The 15.x update is currently being processed by our internal QA process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests