Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
3 tasks done
brakthehack opened this issue Dec 2, 2020 · 2 comments
Open
3 tasks done

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

brakthehack opened this issue Dec 2, 2020 · 2 comments

Comments

@brakthehack
Copy link

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.

@brakthehack brakthehack changed the title Recent updates break compatibility with dcli package vsphere-automation-sdk-python is not compatible with dcli Dec 2, 2020
@anusha94
Copy link
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
Copy link
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants