Skip to content

vsphere-automation-sdk-python is not compatible with dcli #252

Open
@brakthehack

Description

@brakthehack
  • I am using the latest SDK version
    This API is compatible with my vCenter version (You can get the info from 'vcenter_version' in each sample)

Environment

  • sdk package version:
(.wcp_cluster_upgrade_env.Linux) brak[-bin]$ pip list | grep v
DEPRECATION: Python 3.5 reached the end of its life on September 13th, 2020. Please upgrade your Python as Python 3.5 is no longer maintained. pip 21.0 will drop support for Python 3.5 in January 2021. pip 21.0 will remove support for this functionality.
nsx-vmc-aws-integration-python-sdk 3.0.2.0.0.16837625
nsx-vmc-policy-python-sdk          3.0.2.0.0.16837625
pyvmomi                            7.0.1
service-identity                   18.1.0
vapi-client-bindings               3.5.0
vapi-common-client                 2.19.0
vapi-runtime                       2.19.0
vmc-client-bindings                1.29.0
vmc-draas-client-bindings          1.14.0
vSphere-Automation-SDK             1.40.0
  • python version:
(.wcp_cluster_upgrade_env.Linux) brak[-bin]$ python --version
Python 3.5.2
  • vSphere version:
    7.0.1

  • Operating System/Shell (used to run SDK-based apps):
    Linux sc-dbc1104 3.10.0-1062.18.1.el7.x86_64 Tianhao64 patch 1 #1 SMP Tue Mar 17 23:49:17 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Steps or code snippet to reproduce

Install both the latest version of dcli and vsphere-automation-sdk-python. Invoke dcli in the virtualenv and you will get the following stacktrace.

dcli is at 3.0.0 and vsphere-automation-sdk-python is at d27907d

Actual behavior

(.wcp_cluster_upgrade_env.Linux) brak[-bin]$ ./dcli
/dbc/sc-dbc1104/brak/trees/main-18q2/bora/vpx/wcp/support/cicd/.wcp_cluster_upgrade_env.Linux/lib64/python3.5/site-packages/vmware/vapi/client/dcli/util.py:23: CryptographyDeprecationWarning: Python 3.5 support will be dropped in the next release of cryptography. Please upgrade your Python.
  from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
Traceback (most recent call last):
  File "./dcli", line 5, in <module>
    from vmware.vapi.client.dcli.cli import main
  File "/dbc/sc-dbc1104/brak/trees/main-18q2/bora/vpx/wcp/support/cicd/.wcp_cluster_upgrade_env.Linux/lib64/python3.5/site-packages/vmware/vapi/client/dcli/cli.py", line 24, in <module>
    from vmware.vapi.client.dcli.connection import CliConnection
  File "/dbc/sc-dbc1104/brak/trees/main-18q2/bora/vpx/wcp/support/cicd/.wcp_cluster_upgrade_env.Linux/lib64/python3.5/site-packages/vmware/vapi/client/dcli/connection.py", line 33, in <module>
    from vmware.vapi.client.dcli.metadata.file_metadata_provider import \
  File "/dbc/sc-dbc1104/brak/trees/main-18q2/bora/vpx/wcp/support/cicd/.wcp_cluster_upgrade_env.Linux/lib64/python3.5/site-packages/vmware/vapi/client/dcli/metadata/file_metadata_provider.py", line 33, in <module>
    from com.vmware.vapi_client import MetadataInfo
ImportError: cannot import name 'MetadataInfo'

Expected behavior

If I force install the dcli in the current environment, it installs the proper dependencies and starts.

(.wcp_cluster_upgrade_env.Linux) brak[-site-packages]$ pip install --force dcli
(.wcp_cluster_upgrade_env.Linux) brak[-site-packages]$ dcli
/dbc/sc-dbc1104/brak/trees/main-18q2/bora/vpx/wcp/support/cicd/.wcp_cluster_upgrade_env.Linux/lib64/python3.5/site-packages/vmware/vapi/client/dcli/util.py:23: CryptographyDeprecationWarning: Python 3.5 support will be dropped in the next release of cryptography. Please upgrade your Python.
  from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
Welcome to VMware Datacenter CLI (DCLI)

usage: dcli <namespaces> <command>

To connect to specified vAPI server: dcli +server <server>
To connect to VMC: dcli +vmc-server or simply: dcli +vmc
To connect to NSX: dcli +nsx-server <nsx-server> or simply: dcli +nsx <nsx-server>
To enter interactive shell mode: dcli +interactive or simply: dcli +i
To execute dcli internal command: dcli env
For detailed help please use: dcli --help

This seems to be an issue where dcli bundles includes the vapi_client that it needs. However, this is overwritten by dependencies included in vsphere-automation-sdk.

Activity

changed the title [-]Recent updates break compatibility with dcli package[/-] [+]vsphere-automation-sdk-python is not compatible with dcli[/+] on Dec 2, 2020
anusha94

anusha94 commented on Mar 15, 2021

@anusha94
Contributor

@brakthehack

Thanks for reporting this. It is because both Automation SDK and dcli uses the same runtime library, and may go out of sync due to different release timelines. We will look at syncing our release schedule to mitigate this issue.

Thanks!

strefethen

strefethen commented on Mar 16, 2021

@strefethen
Contributor

@brakthehack an alternative would be to use separate Python environments, one for each SDK and dcli.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @strefethen@brakthehack@anusha94

        Issue actions

          vsphere-automation-sdk-python is not compatible with dcli · Issue #252 · vmware/vsphere-automation-sdk-python