Skip to content

Troubleshooting

Anusha Hegde edited this page Jan 12, 2021 · 4 revisions

Installation raises error "Could not find a version that satisfies the requirement..."

  • Symptoms
    pip install cmd failed with error:
    "No matching distribution found for vapi-client-bindings==1.x.0 (from -r requirements.txt..."

  • Cause
    File path was incorrect.

  • Resolution
    Pass absolute file URI scheme to the sdk lib folder. for e.g:
    For Mac:
    pip install --upgrade --force-reinstall -r requirements.txt --extra-index-url file:///Users/strefethen/github/vsphere-automation-sdk-python/lib
    For Windows:
    pip install --upgrade --force-reinstall -r requirements.txt --extra-index-url file:\\\C:\Users\strefethen\github\vsphere-automation-sdk-python\lib

API invocation failed with error "com.vmware.vapi.std.errors_client.OperationNotFound..."

  • Symptoms
    API call failed with exception: "com.vmware.vapi.std.errors_client.OperationNotFound:
    {messages : [LocalizableMessage(id='vapi.method.input.invalid.interface',
    default_message="Cannot find service 'X.X.X.X'.", args=['X.X.X.X'])], data : None}"

  • Cause
    vCenter version is too old and doesn't support the API yet.

  • Resolution
    Only work with APIs that are supported by your vCenter. You can find the supported vCenter versions in the latest On-Prem vCenter Python API doc. For vcenter_client module, you can see the API reference stated that "The module is available starting in vSphere 6.5.".
    You can also find out what are the supported vSphere versions of each SDK sample in the general comment section. Such as: https://github.com/vmware/vsphere-automation-sdk-python/blob/master/samples/vsphere/vcenter/vm/list_vms.py#L18

Certificate verification failed when making API calls

  • Symptoms
    Making API calls raise following exception:
    ... RecursionError: maximum recursion depth exceeded while calling a Python object
    ...
    OpenSSL.SSL.Error: [('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')]
    ...
    ssl.SSLError: ("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",)

  • Cause
    vCenter server doesn't have a valid certificate configured.

  • Resolution
    You can skip the certificate verification on the client side.
    If you run python sdk samples, you can pass "--skipverification" cmd parameter.
    If you making API calls in python cli, you can disable cert verification on the session object:
    session = requests.session()
    session.verify = False

Note

If the issue persists after setting the session.verify to False, please check the REQUESTS_CA_BUNDLE environment variable on your host. If any value is set, it will override the session.verify setting. This is a known issue in the requests library that the SDK uses. We do not want to provide a workaround in the SDK as it might affect the host's environment and cause any unintended side effects. You can track it's progress here - https://github.com/psf/requests/issues/3829

Unable to authenticate to API endpoint with correct credentials

  • Symptoms
    Login using correct username/password failed with exception:
    com.vmware.vapi.std.errors_client.Unauthenticated: {messages : [LocalizableMessage( id='com.vmware.vapi.endpoint.method.authentication.required', default_message='Authentication required.', args=[])], data : None

  • Cause
    Used double quote for cmd parameters and didn't escape special chars in bash CLI. See Bash manual

  • Resolution
    Use single quote for cmd parameter values. Or escape special chars such as "$" when using double quote.

Unable to install the sdk using pip cmd with file URL scheme

  • Symptoms Executing pip install cmd throws exception:
Exception:
Traceback (most recent call last):
  File "/home/vmc-pytest/venv_test/lib/python3.5/site-packages/pip/_internal/cli/base_command.py", line 143, in main
...
    if is_ipv4_address(parsed.hostname):
  File "/home/vmc-pytest/venv_test/lib/python3.5/site-packages/pip/_vendor/requests/utils.py", line 640, in is_ipv4_address
    socket.inet_aton(string_ip)
TypeError: inet_aton() argument 1 must be str, not None