Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 30, 2025

The 4.0.0 release fails with ImportError: cannot import name 'BlobServiceClient' from 'azure.storage.blob'. PR #513 migrated the code to use azure-storage-blob v12+ API but left azure-storage-common in dependencies. These packages conflict—pip downgrades azure-storage-blob to a pre-v12 version that lacks BlobServiceClient.

Changes

  • pyproject.toml: Removed azure-storage-common dependency

azure-storage-blob v12+ includes all necessary functionality and is incompatible with azure-storage-common, which was only used with pre-v12 versions.

Fixes #522

Original prompt

This section details on the original issue you should resolve

<issue_title>Bug: ImportError: cannot import name 'BlobServiceClient' from 'azure.storage.blob'</issue_title>
<issue_description>In the new 4.0.0 release, there seems to be the following bug.

19:20:38  + pytest tests/foreman --collect-only -qq
19:21:24  Traceback (most recent call last):
19:21:24    File "/opt/app-root/lib64/python3.12/site-packages/_pytest/config/__init__.py", line 860, in import_plugin
19:21:24      __import__(importspec)
19:21:24    File "/opt/app-root/lib64/python3.12/site-packages/_pytest/assertion/rewrite.py", line 186, in exec_module
19:21:24      exec(co, module.__dict__)
19:21:24    File "/opt/app-root/src/robottelo/pytest_plugins/metadata_markers.py", line 8, in <module>
19:21:24      from robottelo.hosts import get_sat_rhel_version
19:21:24    File "/opt/app-root/src/robottelo/robottelo/hosts.py", line 29, in <module>
19:21:24      from wrapanapi.entities.vm import VmState
19:21:24    File "/opt/app-root/lib64/python3.12/site-packages/wrapanapi/__init__.py", line 3, in <module>
19:21:24      from .systems.container.podman import Podman
19:21:24    File "/opt/app-root/lib64/python3.12/site-packages/wrapanapi/systems/__init__.py", line 5, in <module>
19:21:24      from .msazure import AzureSystem
19:21:24    File "/opt/app-root/lib64/python3.12/site-packages/wrapanapi/systems/msazure.py", line 21, in <module>
19:21:24      from azure.storage.blob import BlobServiceClient
19:21:24  ImportError: cannot import name 'BlobServiceClient' from 'azure.storage.blob' (/opt/app-root/lib64/python3.12/site-packages/azure/storage/blob/__init__.py)
19:21:24  
19:21:24  The above exception was the direct cause of the following exception:
19:21:24  
19:21:24  Traceback (most recent call last):
19:21:24    File "/opt/app-root/bin/pytest", line 10, in <module>
19:21:24      sys.exit(console_main())
19:21:24               ^^^^^^^^^^^^^^
19:21:24    File "/opt/app-root/lib64/python3.12/site-packages/_pytest/config/__init__.py", line 201, in console_main
19:21:24      code = main()
19:21:24             ^^^^^^
19:21:24    File "/opt/app-root/lib64/python3.12/site-packages/_pytest/config/__init__.py", line 156, in main
19:21:24      config = _prepareconfig(args, plugins)
19:21:24               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
19:21:24    File "/opt/app-root/lib64/python3.12/site-packages/_pytest/config/__init__.py", line 342, in _prepareconfig
19:21:24      config = pluginmanager.hook.pytest_cmdline_parse(
19:21:24               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
19:21:24    File "/opt/app-root/lib64/python3.12/site-packages/pluggy/_hooks.py", line 512, in __call__
19:21:24      return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
19:21:24             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
19:21:24    File "/opt/app-root/lib64/python3.12/site-packages/pluggy/_manager.py", line 120, in _hookexec
19:21:24      return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
19:21:24             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
19:21:24    File "/opt/app-root/lib64/python3.12/site-packages/pluggy/_callers.py", line 167, in _multicall
19:21:24      raise exception
19:21:24    File "/opt/app-root/lib64/python3.12/site-packages/pluggy/_callers.py", line 139, in _multicall
19:21:24      teardown.throw(exception)
19:21:24    File "/opt/app-root/lib64/python3.12/site-packages/_pytest/helpconfig.py", line 112, in pytest_cmdline_parse
19:21:24      config = yield
19:21:24               ^^^^^
19:21:24    File "/opt/app-root/lib64/python3.12/site-packages/pluggy/_callers.py", line 121, in _multicall
19:21:24      res = hook_impl.function(*args)
19:21:24            ^^^^^^^^^^^^^^^^^^^^^^^^^
19:21:24    File "/opt/app-root/lib64/python3.12/site-packages/_pytest/config/__init__.py", line 1146, in pytest_cmdline_parse
19:21:24      self.parse(args)
19:21:24    File "/opt/app-root/lib64/python3.12/site-packages/_pytest/config/__init__.py", line 1527, in parse
19:21:24      self._preparse(args, addopts=addopts)
19:21:24    File "/opt/app-root/lib64/python3.12/site-packages/_pytest/config/__init__.py", line 1431, in _preparse
19:21:24      self.hook.pytest_load_initial_conftests(
19:21:24    File "/opt/app-root/lib64/python3.12/site-packages/pluggy/_hooks.py", line 512, in __call__
19:21:24      return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
19:21:24             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
19:21:24    File "/opt/app-root/lib64/python3.12/site-packages/pluggy/_manager.py", line 120, in _hookexec
19:21:24      return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
19:21:24             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
19:21:24    File "/opt/app-root/lib64/python3.12/site-packages/pluggy/_callers.py", line 167, in _multicall
19:21:24      raise ...

</details>

- Fixes RedHatQE/wrapanapi#522

<!-- START COPILOT CODING AGENT TIPS -->
---

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs.

…t error

Co-authored-by: ogajduse <20440883+ogajduse@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix ImportError for BlobServiceClient in Azure Storage Blob Remove azure-storage-common to fix BlobServiceClient ImportError Oct 30, 2025
Copilot AI requested a review from ogajduse October 30, 2025 17:31
@ogajduse ogajduse marked this pull request as ready for review October 31, 2025 08:54
@Gauravtalreja1 Gauravtalreja1 merged commit 8154321 into master Oct 31, 2025
7 checks passed
@Gauravtalreja1 Gauravtalreja1 deleted the copilot/fix-importerror-azure-blob branch October 31, 2025 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: ImportError: cannot import name 'BlobServiceClient' from 'azure.storage.blob'

3 participants