Azure/azure-storage-python

Cannot import name 'RecoveryServicesBackupClient' from 'azure.mgmt.recoveryservicesbackup'

Zman94 opened this issue · 3 comments

Which service(blob, file, queue) does this issue concern?

Note: for package version >= 12.0.0 please post the issue here instead: https://github.com/Azure/azure-sdk-for-python/issues
      for table service, please post the issue here instead: https://github.com/Azure/azure-cosmosdb-python.

azure.mgmt.recoveryservicesbackup

Which version of the SDK was used? Please provide the output of pip freeze.

(venv) zachgleason@aerospike-1-0:~$ pip freeze
azure-common==1.1.28
azure-core==1.24.1
azure-mgmt-core==1.3.1
azure-mgmt-recoveryservicesbackup==4.0.0
certifi==2022.6.15
charset-normalizer==2.1.0
idna==3.3
isodate==0.6.1
msrest==0.7.1
oauthlib==3.2.0
requests==2.28.1
requests-oauthlib==1.3.1
six==1.16.0
typing_extensions==4.2.0
urllib3==1.26.9

What problem was encountered?

(venv) zachgleason@aerospike-1-0:~$ python
Python 3.7.3 (default, Jan 22 2021, 20:04:44) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'RecoveryServicesBackupClient' from 'azure.mgmt.recoveryservicesbackup' (/home/zachgleason/venv/lib/python3.7/site-packages/azure/mgmt/recoveryservicesbackup/__init__.py)

Have you found a mitigation/solution?

No

Same issue on 5.0.0

(venv) zachgleason@aerospike-1-0:~$ pip install azure-mgmt-recoveryservicesbackup==5.0.0
Collecting azure-mgmt-recoveryservicesbackup==5.0.0
  Using cached azure_mgmt_recoveryservicesbackup-5.0.0-py3-none-any.whl (484 kB)
Requirement already satisfied: azure-mgmt-core<2.0.0,>=1.3.0 in ./venv/lib/python3.7/site-packages (from azure-mgmt-recoveryservicesbackup==5.0.0) (1.3.1)
Requirement already satisfied: msrest>=0.6.21 in ./venv/lib/python3.7/site-packages (from azure-mgmt-recoveryservicesbackup==5.0.0) (0.7.1)
Requirement already satisfied: azure-common~=1.1 in ./venv/lib/python3.7/site-packages (from azure-mgmt-recoveryservicesbackup==5.0.0) (1.1.28)
Requirement already satisfied: azure-core<2.0.0,>=1.23.0 in ./venv/lib/python3.7/site-packages (from azure-mgmt-core<2.0.0,>=1.3.0->azure-mgmt-recoveryservicesbackup==5.0.0) (1.24.1)
Requirement already satisfied: isodate>=0.6.0 in ./venv/lib/python3.7/site-packages (from msrest>=0.6.21->azure-mgmt-recoveryservicesbackup==5.0.0) (0.6.1)
Requirement already satisfied: requests-oauthlib>=0.5.0 in ./venv/lib/python3.7/site-packages (from msrest>=0.6.21->azure-mgmt-recoveryservicesbackup==5.0.0) (1.3.1)
Requirement already satisfied: certifi>=2017.4.17 in ./venv/lib/python3.7/site-packages (from msrest>=0.6.21->azure-mgmt-recoveryservicesbackup==5.0.0) (2022.6.15)
Requirement already satisfied: requests~=2.16 in ./venv/lib/python3.7/site-packages (from msrest>=0.6.21->azure-mgmt-recoveryservicesbackup==5.0.0) (2.28.1)
Requirement already satisfied: six>=1.11.0 in ./venv/lib/python3.7/site-packages (from azure-core<2.0.0,>=1.23.0->azure-mgmt-core<2.0.0,>=1.3.0->azure-mgmt-recoveryservicesbackup==5.0.0) (1.16.0)
Requirement already satisfied: typing-extensions>=4.0.1 in ./venv/lib/python3.7/site-packages (from azure-core<2.0.0,>=1.23.0->azure-mgmt-core<2.0.0,>=1.3.0->azure-mgmt-recoveryservicesbackup==5.0.0) (4.2.0)
Requirement already satisfied: charset-normalizer<3,>=2 in ./venv/lib/python3.7/site-packages (from requests~=2.16->msrest>=0.6.21->azure-mgmt-recoveryservicesbackup==5.0.0) (2.1.0)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in ./venv/lib/python3.7/site-packages (from requests~=2.16->msrest>=0.6.21->azure-mgmt-recoveryservicesbackup==5.0.0) (1.26.9)
Requirement already satisfied: idna<4,>=2.5 in ./venv/lib/python3.7/site-packages (from requests~=2.16->msrest>=0.6.21->azure-mgmt-recoveryservicesbackup==5.0.0) (3.3)
Requirement already satisfied: oauthlib>=3.0.0 in ./venv/lib/python3.7/site-packages (from requests-oauthlib>=0.5.0->msrest>=0.6.21->azure-mgmt-recoveryservicesbackup==5.0.0) (3.2.0)
Installing collected packages: azure-mgmt-recoveryservicesbackup
Successfully installed azure-mgmt-recoveryservicesbackup-5.0.0
(venv) zachgleason@aerospike-1-0:~$ python
Python 3.7.3 (default, Jan 22 2021, 20:04:44) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'RecoveryServicesBackupClient' from 'azure.mgmt.recoveryservicesbackup' (/home/zachgleason/venv/lib/python3.7/site-packages/azure/mgmt/recoveryservicesbackup/__init__.py)

For reference, this is an issue on the ansible azure_rm_storageblob: role

Same issue here.

I am on Ubuntu 20.04.5 with all latest patches.
Python 3.8.10
Ansible 6.4.0 installed with "pip3 install ansible"
Virtual environment with python and ansible

ansible [core 2.13.4]
  config file = /opt/ansible/ansible.cfg
  configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.8/dist-packages/ansible
  ansible collection location = /home/user/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.8.10 (default, Jun 22 2022, 20:18:18) [GCC 9.4.0]
  jinja version = 3.1.2
  libyaml = True

Pip freeze gives:

adal==1.2.7
ansible==6.4.0
ansible-core==2.13.4
applicationinsights==0.11.10
argcomplete==1.12.3
azure-cli-core==2.40.0
azure-cli-telemetry==1.0.8
azure-common==1.1.28
azure-core==1.25.1
azure-graphrbac==0.61.1
azure-identity==1.10.0
azure-keyvault==4.2.0
azure-keyvault-certificates==4.5.1
azure-keyvault-keys==4.6.1
azure-keyvault-secrets==4.5.1
azure-mgmt-apimanagement==3.0.0
azure-mgmt-authorization==2.0.0
azure-mgmt-automation==1.0.0
azure-mgmt-batch==16.2.0
azure-mgmt-cdn==12.0.0
azure-mgmt-compute==27.2.0
azure-mgmt-containerinstance==10.0.0
azure-mgmt-containerregistry==10.0.0
azure-mgmt-containerservice==20.3.0
azure-mgmt-core==1.3.2
azure-mgmt-cosmosdb==8.0.0
azure-mgmt-datalake-nspkg==3.0.1
azure-mgmt-datalake-store==0.5.0
azure-mgmt-devtestlabs==9.0.0
azure-mgmt-dns==8.0.0
azure-mgmt-eventhub==10.1.0
azure-mgmt-hdinsight==9.0.0
azure-mgmt-iothub==2.3.0
azure-mgmt-keyvault==10.1.0
azure-mgmt-loganalytics==12.0.0
azure-mgmt-managedservices==6.0.0
azure-mgmt-managementgroups==1.0.0
azure-mgmt-marketplaceordering==1.1.0
azure-mgmt-monitor==4.0.1
azure-mgmt-network==21.0.1
azure-mgmt-notificationhubs==8.0.0
azure-mgmt-nspkg==3.0.2
azure-mgmt-privatedns==1.0.0
azure-mgmt-rdbms==10.1.0
azure-mgmt-recoveryservices==2.1.0
azure-mgmt-recoveryservicesbackup==5.1.0b1
azure-mgmt-redis==14.0.0
azure-mgmt-resource==21.1.0
azure-mgmt-search==8.0.0
azure-mgmt-servicebus==8.1.0
azure-mgmt-sql==3.0.1
azure-mgmt-storage==20.1.0
azure-mgmt-trafficmanager==1.0.0
azure-mgmt-web==7.0.0
azure-nspkg==3.0.2
azure-storage==0.35.1
bcrypt==4.0.0
certifi==2022.9.14
cffi==1.15.1
charset-normalizer==2.1.1
cryptography==38.0.1
humanfriendly==10.0
idna==3.4
isodate==0.6.1
Jinja2==3.1.2
jmespath==1.0.1
knack==0.10.0
MarkupSafe==2.1.1
msal==1.18.0b1
msal-extensions==1.0.0
msrest==0.7.1
msrestazure==0.6.4
oauthlib==3.2.1
packaging==21.3
paramiko==2.11.0
pkginfo==1.8.3
portalocker==2.5.1
psutil==5.9.2
pycparser==2.21
Pygments==2.13.0
PyJWT==2.4.0
PyNaCl==1.5.0
pyOpenSSL==22.0.0
pyparsing==3.0.9
PySocks==1.7.1
python-dateutil==2.8.2
PyYAML==6.0
requests==2.28.1
requests-oauthlib==1.3.1
resolvelib==0.8.1
six==1.16.0
tabulate==0.8.10
typing_extensions==4.3.0
urllib3==1.26.12
xmltodict==0.13.0

Any workarounds?
All attempts at using azure to crfeate e.g. a resoutce group generates the error as described for this issue:

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ImportError: cannot import name 'RecoveryServicesBackupClient' from 'azure.mgmt.recoveryservicesbackup' (/home/user/.local/lib/python3.8/site-packages/azure/mgmt/recoveryservicesbackup/__init__.py)
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Failed to import the required Python library (ansible[azure] (azure >= 2.0.0)) on MBJWRK001W's Python /usr/bin/python3. Please read the module documentation and install it in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter"}