kubernetes-typed icon indicating copy to clipboard operation
kubernetes-typed copied to clipboard

Circular references

Open callum-p opened this issue 2 years ago • 1 comments

Hi there,

I'm getting the below error when using this:

from kubernetes_typed.client import V1PodDict
ImportError: cannot import name 'AdmissionregistrationV1ServiceReferenceDict' from partially initialized module 'kubernetes_typed.client' (most likely due to a circular import) (/home/user/repos/xxx/k8s-monitor/.venv/lib/python3.8/site-packages/kubernetes_typed/client/__init__.py)

callum-p avatar Mar 09 '22 03:03 callum-p

Can confirm this is happening on a clean env.

$ docker run --rm -it python:3-alpine sh -c 'pip install kubernetes-typed[client] && python -c "from kubernetes_typed.client import V1PodDict"'
Collecting kubernetes-typed[client]
...
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.11/site-packages/kubernetes_typed/client/__init__.py", line 3, in <module>
    from kubernetes_typed.client.models.admissionregistration_v1_service_reference import AdmissionregistrationV1ServiceReferenceDict
  File "/usr/local/lib/python3.11/site-packages/kubernetes_typed/client/models/__init__.py", line 4, in <module>
    from kubernetes_typed.client.models.admissionregistration_v1_webhook_client_config import AdmissionregistrationV1WebhookClientConfigDict
  File "/usr/local/lib/python3.11/site-packages/kubernetes_typed/client/models/admissionregistration_v1_webhook_client_config.py", line 5, in <module>
    from kubernetes_typed.client import AdmissionregistrationV1ServiceReferenceDict
ImportError: cannot import name 'AdmissionregistrationV1ServiceReferenceDict' from partially initialized module 'kubernetes_typed.client' (most likely due to a circular import) (/usr/local/lib/python3.11/site-packages/kubernetes_typed/client/__init__.py)

I ran simple git bisect and it seems that this actually never worked :thinking:

suside avatar Nov 03 '22 12:11 suside