vmware / vsphere-automation-sdk-python

Python samples, language bindings, and API reference documentation for vSphere, VMC, and NSX-T using the VMware REST API
MIT License
745 stars 313 forks source link

Deprecation warnings from setuptools #363

Closed sodul closed 3 months ago

sodul commented 1 year ago

Describe the bug

vmware/vapi/vsphere/__init__.py:5
    /root/.pyenv/versions/3.11.2/lib/python3.11/site-packages/vmware/vapi/vsphere/__init__.py:5: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('vmware.vapi.vsphere')`.
    Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
      pkg_resources.declare_namespace(__name__)

Reproduction steps

  1. Install latest SDK: pip install --upgrade git+https://github.com/vmware/vsphere-automation-sdk-python.git
  2. Run code that uses the SDK.

Expected behavior

No warnings.

Additional context

No response

aagrawal3 commented 1 year ago

Hi @sodul As of setuptools v67.3.0 the use of "pkg_resources.declare_namespace" method raises deprecation warning. Our Python SDK uses setuptools v62.0.0 as mentioned in requirements.txt We highly recommend following our installation guide - https://github.com/vmware/vsphere-automation-sdk-python#quick-start-guide

sodul commented 1 year ago

@aagrawal3 we have other dependencies that cannot install with setuptools v62.0.0. Our workaround is to install the sdk first and then our stack on top and ignore what the SDK claims in its requirements.

This is still a forward compatibility bug and I believe the SDK should be fixed to work with newer versions of setuptools.

Xionghaizi001 commented 1 year ago

@aagrawal3 I have the same problem. Even I rollback my python to 3.6.x, it also tells me the setuptools have an error, and can't collect it from pip official site. When I manually download it to install, it tells me that "future feature annotations is not defined".