Skip to content

The msgraph-core 1.1.8 import of LargeFileUpload tasks raises 'ABCMeta' object is not subscriptable errorΒ #781

@potiuk

Description

@potiuk

Describe the bug

When you install msgraph-core 1.1.8 and attempt to import LargeFileUploadTask it fails with 'ABCMeta' object is not subscriptable error. This was working fine in 1.1.7.

The stacktrace:

  File "/opt/airflow/airflow/models/dagbag.py", line 384, in parse
    loader.exec_module(new_module)
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/opt/airflow/providers/tests/system/microsoft/azure/example_powerbi_dataset_refresh.py", line 26, in <module>
    from airflow.providers.microsoft.azure.operators.powerbi import PowerBIDatasetRefreshOperator
  File "/opt/airflow/providers/src/airflow/providers/microsoft/azure/operators/powerbi.py", line 25, in <module>
    from airflow.providers.microsoft.azure.hooks.powerbi import (
  File "/opt/airflow/providers/src/airflow/providers/microsoft/azure/hooks/powerbi.py", line 24, in <module>
    from airflow.providers.microsoft.azure.hooks.msgraph import KiotaRequestAdapterHook
  File "/opt/airflow/providers/src/airflow/providers/microsoft/azure/hooks/msgraph.py", line 43, in <module>
    from msgraph_core import APIVersion, GraphClientFactory
  File "/usr/local/lib/python3.9/site-packages/msgraph_core/__init__.py", line 16, in <module>
    from .tasks import PageIterator
  File "/usr/local/lib/python3.9/site-packages/msgraph_core/tasks/__init__.py", line 2, in <module>
    from .large_file_upload import LargeFileUploadTask
  File "/usr/local/lib/python3.9/site-packages/msgraph_core/tasks/large_file_upload.py", line 21, in <module>
    class LargeFileUploadTask:
  File "/usr/local/lib/python3.9/site-packages/msgraph_core/tasks/large_file_upload.py", line 28, in LargeFileUploadTask
    parsable_factory: Optional[ParsableFactory[T]] = None,
TypeError: 'ABCMeta' object is not subscriptable

Example failures in airflow CI: https://github.com/apache/airflow/actions/runs/12394058058/job/34597170319#step:7:2472

Expected behavior

No exception raised when importing the class.

How to reproduce

  • Install msgraph-core 1.1.8
  • Run this:
from msgraph_core import APIVersion, GraphClientFactory

Result:

root@5ae8d440acf3:/opt/airflow# pip install msgraph-core==1.1.8
Collecting msgraph-core==1.1.8
  Downloading msgraph_core-1.1.8-py3-none-any.whl.metadata (7.4 kB)
Requirement already satisfied: microsoft-kiota-abstractions<2.0.0,>=1.0.0 in /usr/local/lib/python3.9/site-packages (from msgraph-core==1.1.8) (1.3.3)
Requirement already satisfied: microsoft-kiota-authentication-azure<2.0.0,>=1.0.0 in /usr/local/lib/python3.9/site-packages (from msgraph-core==1.1.8) (1.1.0)
Requirement already satisfied: microsoft-kiota-http<2.0.0,>=1.0.0 in /usr/local/lib/python3.9/site-packages (from msgraph-core==1.1.8) (1.3.3)
Requirement already satisfied: httpx>=0.23.0 in /usr/local/lib/python3.9/site-packages (from httpx[http2]>=0.23.0->msgraph-core==1.1.8) (0.27.0)
Requirement already satisfied: anyio in /usr/local/lib/python3.9/site-packages (from httpx>=0.23.0->httpx[http2]>=0.23.0->msgraph-core==1.1.8) (4.7.0)
Requirement already satisfied: certifi in /usr/local/lib/python3.9/site-packages (from httpx>=0.23.0->httpx[http2]>=0.23.0->msgraph-core==1.1.8) (2024.12.14)
Requirement already satisfied: httpcore==1.* in /usr/local/lib/python3.9/site-packages (from httpx>=0.23.0->httpx[http2]>=0.23.0->msgraph-core==1.1.8) (1.0.7)
Requirement already satisfied: idna in /usr/local/lib/python3.9/site-packages (from httpx>=0.23.0->httpx[http2]>=0.23.0->msgraph-core==1.1.8) (3.10)
Requirement already satisfied: sniffio in /usr/local/lib/python3.9/site-packages (from httpx>=0.23.0->httpx[http2]>=0.23.0->msgraph-core==1.1.8) (1.3.1)
Requirement already satisfied: h11<0.15,>=0.13 in /usr/local/lib/python3.9/site-packages (from httpcore==1.*->httpx>=0.23.0->httpx[http2]>=0.23.0->msgraph-core==1.1.8) (0.14.0)
Requirement already satisfied: h2<5,>=3 in /usr/local/lib/python3.9/site-packages (from httpx[http2]>=0.23.0->msgraph-core==1.1.8) (4.1.0)
Requirement already satisfied: std-uritemplate>=0.0.38 in /usr/local/lib/python3.9/site-packages (from microsoft-kiota-abstractions<2.0.0,>=1.0.0->msgraph-core==1.1.8) (2.0.1)
Requirement already satisfied: opentelemetry-api>=1.19.0 in /usr/local/lib/python3.9/site-packages (from microsoft-kiota-abstractions<2.0.0,>=1.0.0->msgraph-core==1.1.8) (1.27.0)
Requirement already satisfied: opentelemetry-sdk>=1.19.0 in /usr/local/lib/python3.9/site-packages (from microsoft-kiota-abstractions<2.0.0,>=1.0.0->msgraph-core==1.1.8) (1.27.0)
Requirement already satisfied: aiohttp>=3.8.0 in /usr/local/lib/python3.9/site-packages (from microsoft-kiota-authentication-azure<2.0.0,>=1.0.0->msgraph-core==1.1.8) (3.11.10)
Requirement already satisfied: azure-core>=1.21.1 in /usr/local/lib/python3.9/site-packages (from microsoft-kiota-authentication-azure<2.0.0,>=1.0.0->msgraph-core==1.1.8) (1.32.0)
Requirement already satisfied: aiohappyeyeballs>=2.3.0 in /usr/local/lib/python3.9/site-packages (from aiohttp>=3.8.0->microsoft-kiota-authentication-azure<2.0.0,>=1.0.0->msgraph-core==1.1.8) (2.4.4)
Requirement already satisfied: aiosignal>=1.1.2 in /usr/local/lib/python3.9/site-packages (from aiohttp>=3.8.0->microsoft-kiota-authentication-azure<2.0.0,>=1.0.0->msgraph-core==1.1.8) (1.3.2)
Requirement already satisfied: async-timeout<6.0,>=4.0 in /usr/local/lib/python3.9/site-packages (from aiohttp>=3.8.0->microsoft-kiota-authentication-azure<2.0.0,>=1.0.0->msgraph-core==1.1.8) (5.0.1)
Requirement already satisfied: attrs>=17.3.0 in /usr/local/lib/python3.9/site-packages (from aiohttp>=3.8.0->microsoft-kiota-authentication-azure<2.0.0,>=1.0.0->msgraph-core==1.1.8) (24.3.0)
Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib/python3.9/site-packages (from aiohttp>=3.8.0->microsoft-kiota-authentication-azure<2.0.0,>=1.0.0->msgraph-core==1.1.8) (1.5.0)
Requirement already satisfied: multidict<7.0,>=4.5 in /usr/local/lib/python3.9/site-packages (from aiohttp>=3.8.0->microsoft-kiota-authentication-azure<2.0.0,>=1.0.0->msgraph-core==1.1.8) (6.1.0)
Requirement already satisfied: propcache>=0.2.0 in /usr/local/lib/python3.9/site-packages (from aiohttp>=3.8.0->microsoft-kiota-authentication-azure<2.0.0,>=1.0.0->msgraph-core==1.1.8) (0.2.1)
Requirement already satisfied: yarl<2.0,>=1.17.0 in /usr/local/lib/python3.9/site-packages (from aiohttp>=3.8.0->microsoft-kiota-authentication-azure<2.0.0,>=1.0.0->msgraph-core==1.1.8) (1.18.3)
Requirement already satisfied: requests>=2.21.0 in /usr/local/lib/python3.9/site-packages (from azure-core>=1.21.1->microsoft-kiota-authentication-azure<2.0.0,>=1.0.0->msgraph-core==1.1.8) (2.32.3)
Requirement already satisfied: six>=1.11.0 in /usr/local/lib/python3.9/site-packages (from azure-core>=1.21.1->microsoft-kiota-authentication-azure<2.0.0,>=1.0.0->msgraph-core==1.1.8) (1.17.0)
Requirement already satisfied: typing-extensions>=4.6.0 in /usr/local/lib/python3.9/site-packages (from azure-core>=1.21.1->microsoft-kiota-authentication-azure<2.0.0,>=1.0.0->msgraph-core==1.1.8) (4.12.2)
Requirement already satisfied: hyperframe<7,>=6.0 in /usr/local/lib/python3.9/site-packages (from h2<5,>=3->httpx[http2]>=0.23.0->msgraph-core==1.1.8) (6.0.1)
Requirement already satisfied: hpack<5,>=4.0 in /usr/local/lib/python3.9/site-packages (from h2<5,>=3->httpx[http2]>=0.23.0->msgraph-core==1.1.8) (4.0.0)
Requirement already satisfied: deprecated>=1.2.6 in /usr/local/lib/python3.9/site-packages (from opentelemetry-api>=1.19.0->microsoft-kiota-abstractions<2.0.0,>=1.0.0->msgraph-core==1.1.8) (1.2.15)
Requirement already satisfied: importlib-metadata<=8.4.0,>=6.0 in /usr/local/lib/python3.9/site-packages (from opentelemetry-api>=1.19.0->microsoft-kiota-abstractions<2.0.0,>=1.0.0->msgraph-core==1.1.8) (6.11.0)
Requirement already satisfied: opentelemetry-semantic-conventions==0.48b0 in /usr/local/lib/python3.9/site-packages (from opentelemetry-sdk>=1.19.0->microsoft-kiota-abstractions<2.0.0,>=1.0.0->msgraph-core==1.1.8) (0.48b0)
Requirement already satisfied: exceptiongroup>=1.0.2 in /usr/local/lib/python3.9/site-packages (from anyio->httpx>=0.23.0->httpx[http2]>=0.23.0->msgraph-core==1.1.8) (1.2.2)
Requirement already satisfied: wrapt<2,>=1.10 in /usr/local/lib/python3.9/site-packages (from deprecated>=1.2.6->opentelemetry-api>=1.19.0->microsoft-kiota-abstractions<2.0.0,>=1.0.0->msgraph-core==1.1.8) (1.17.0)
Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.9/site-packages (from importlib-metadata<=8.4.0,>=6.0->opentelemetry-api>=1.19.0->microsoft-kiota-abstractions<2.0.0,>=1.0.0->msgraph-core==1.1.8) (3.21.0)
Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.9/site-packages (from requests>=2.21.0->azure-core>=1.21.1->microsoft-kiota-authentication-azure<2.0.0,>=1.0.0->msgraph-core==1.1.8) (3.4.0)
Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.9/site-packages (from requests>=2.21.0->azure-core>=1.21.1->microsoft-kiota-authentication-azure<2.0.0,>=1.0.0->msgraph-core==1.1.8) (1.26.20)
Downloading msgraph_core-1.1.8-py3-none-any.whl (35 kB)
Installing collected packages: msgraph-core
  Attempting uninstall: msgraph-core
    Found existing installation: msgraph-core 1.1.7
    Uninstalling msgraph-core-1.1.7:
      Successfully uninstalled msgraph-core-1.1.7
Successfully installed msgraph-core-1.1.8
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable.It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.
root@5ae8d440acf3:/opt/airflow# python
Python 3.9.21 (main, Dec  4 2024, 20:35:10) 
[GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from msgraph_core import APIVersion, GraphClientFactory

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/site-packages/msgraph_core/__init__.py", line 16, in <module>
    from .tasks import PageIterator
  File "/usr/local/lib/python3.9/site-packages/msgraph_core/tasks/__init__.py", line 2, in <module>
    from .large_file_upload import LargeFileUploadTask
  File "/usr/local/lib/python3.9/site-packages/msgraph_core/tasks/large_file_upload.py", line 21, in <module>
    class LargeFileUploadTask:
  File "/usr/local/lib/python3.9/site-packages/msgraph_core/tasks/large_file_upload.py", line 28, in LargeFileUploadTask
    parsable_factory: Optional[ParsableFactory[T]] = None,
TypeError: 'ABCMeta' object is not subscriptable
>>> 
>>> 

SDK Version

1.1.8

Latest version known to work for scenario above?

1.1.7

Known Workarounds

Downgrade msgraph-core to 1.1.7

Debug output

No need for more debugging.

Configuration

Linux Debian Bookworm, Python 3.9.21

Other information

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions