vsphere-automation-sdk-python icon indicating copy to clipboard operation
vsphere-automation-sdk-python copied to clipboard

Fail to install by `poetry`.

Open aragorn1025 opened this issue 1 year ago • 1 comments

Describe the bug

I have tried to add and install vsphere-automation-sdk-python by using poetry.

poetry add "git+https://github.com/vmware/vsphere-automation-sdk-python.git"

However, the following error was raised:

Creating virtualenv mavis in /Users/user/Documents/project/.venv

Updating dependencies
Resolving dependencies... (37.0s)

  RuntimeError

  Unable to retrieve the package version for None

  at ~/.poetry/lib/poetry/inspection/info.py:143 in to_package
      139│         name = name or self.name
      140│
      141│         if not self.version:
      142│             # The version could not be determined, so we raise an error since it is mandatory.
    → 143│             raise RuntimeError(
      144│                 "Unable to retrieve the package version for {}".format(name)
      145│             )
      146│
      147│         package = Package(

As a result, I checked the requirements.txt and find out that if I add vapi-client-bindings==3.9.0, I get the same error message.

  ValueError

  Could not find a matching version of package vapi-client-bindings

  at ~/.poetry/lib/poetry/console/commands/init.py:367 in _find_best_version_for_package
      363│         )
      364│
      365│         if not package:
      366│             # TODO: find similar
    → 367│             raise ValueError(
      368│                 "Could not find a matching version of package {}".format(name)
      369│             )
      370│
      371│         return package.pretty_name, selector.find_recommended_require_version(package)

Reproduction steps

- Run poetry add.
  
  poetry add "git+https://github.com/vmware/vsphere-automation-sdk-python.git"

Expected behavior

Expected to install successful without error raised.

Additional context

No response

aragorn1025 avatar Jul 25 '22 05:07 aragorn1025

Installation using Poetry is currently not tested/supported.

aagrawal3 avatar Jul 26 '22 06:07 aagrawal3

@aragorn1025

I hit the same issue. I can avoid it by the following command

poetry run pip install -U pip setuptools
poetry run pip install --upgrade git+https://github.com/vmware/vsphere-automation-sdk-python.git

ttanigaki avatar Aug 22 '22 10:08 ttanigaki

Any chance of getting this to be supported??

wonderphil avatar Aug 23 '22 19:08 wonderphil

Any chance of getting this to be supported??

Sorry! Not in immediate future. I'm closing this issue as not planned.

Can you please try the workaround mentioned by @ttanigaki and see if it helps?

jobingeo avatar Aug 24 '22 06:08 jobingeo

Closing this, as there is no near term plan to fix this issue.

jobingeo avatar Aug 24 '22 07:08 jobingeo

@ttanigaki Thank you for the solution.

@jobingeo There's another question about requirements.txt. I saw there's a dependent module that can't be downloaded. (I guess this cause error for poetry add.)

vapi-client-bindings == 3.9.0

I search this module and found out that I can only get the newer one. (link here)

vapi-client-bindings == 7.0.0

Will this have any effect?

aragorn1025 avatar Aug 24 '22 14:08 aragorn1025

I search this module and found out that I can only get the newer one. (link here)

vapi-client-bindings == 7.0.0

Will this have any effect?

The vapi-client-bindings lib you see in pypi repo is a dummy one. We just reserved it in PyPi for the future onboarding of SDK libs. For now, please don't rely on these libs from PyPi. Please use these libs locally following the SDK installation instruction here. From above error stack/comments, It seems this could have a potential impact here.

jobingeo avatar Aug 24 '22 14:08 jobingeo

Maybe this can be useful for other poetry users.

For me, with poetry 1.3 I can do poetry add https://github.com/vmware/vsphere-automation-sdk-python/archive/refs/tags/v8.0.0.1.tar.gz which works.

For poetry 1.1 I have to do add all the dependencies using poetry add https://github.com/vmware/vsphere-automation-sdk-python/archive/refs/tags/v8.0.0.1.tar.gz https://github.com/vmware/vsphere-automation-sdk-python/raw/master/lib/nsx-policy-python-sdk/nsx_policy_python_sdk-4.0.1.0.0-py2.py3-none-any.whl https://github.com/vmware/vsphere-automation-sdk-python/raw/master/lib/nsx-python-sdk/nsx_python_sdk-4.0.1.0.0-py2.py3-none-any.whl https://github.com/vmware/vsphere-automation-sdk-python/raw/master/lib/nsx-vmc-aws-integration-python-sdk/nsx_vmc_aws_integration_python_sdk-4.0.1.0.0-py2.py3-none-any.whl https://github.com/vmware/vsphere-automation-sdk-python/raw/master/lib/nsx-vmc-policy-python-sdk/nsx_vmc_policy_python_sdk-4.0.1.0.0-py2.py3-none-any.whl https://github.com/vmware/vsphere-automation-sdk-python/raw/master/lib/vapi-client-bindings/vapi_client_bindings-4.0.0-py2.py3-none-any.whl https://github.com/vmware/vsphere-automation-sdk-python/raw/master/lib/vapi-common-client/vapi_common_client-2.37.0-py2.py3-none-any.whl https://github.com/vmware/vsphere-automation-sdk-python/raw/master/lib/vapi-runtime/vapi_runtime-2.37.0-py2.py3-none-any.whl https://github.com/vmware/vsphere-automation-sdk-python/raw/master/lib/vmc-client-bindings/vmc_client_bindings-1.61.0-py2.py3-none-any.whl https://github.com/vmware/vsphere-automation-sdk-python/raw/master/lib/vmc-draas-client-bindings/vmc_draas_client_bindings-1.20.0-py2.py3-none-any.whl

In my pyproject.toml I get :

[tool.poetry.dependencies]
# vsphere-automation-sdk work around
vsphere-automation-sdk = {url = "https://github.com/vmware/vsphere-automation-sdk-python/archive/refs/tags/v8.0.0.1.tar.gz"}
vmc-draas-client-bindings = {url = "https://github.com/vmware/vsphere-automation-sdk-python/raw/master/lib/vmc-draas-client-bindings/vmc_draas_client_bindings-1.20.0-py2.py3-none-any.whl"}
vapi-runtime = {url = "https://github.com/vmware/vsphere-automation-sdk-python/raw/master/lib/vapi-runtime/vapi_runtime-2.37.0-py2.py3-none-any.whl"}
vapi-common-client = {url = "https://github.com/vmware/vsphere-automation-sdk-python/raw/master/lib/vapi-common-client/vapi_common_client-2.37.0-py2.py3-none-any.whl"}
nsx-policy-python-sdk = {url = "https://github.com/vmware/vsphere-automation-sdk-python/raw/master/lib/nsx-policy-python-sdk/nsx_policy_python_sdk-4.0.1.0.0-py2.py3-none-any.whl"}
nsx-python-sdk = {url = "https://github.com/vmware/vsphere-automation-sdk-python/raw/master/lib/nsx-python-sdk/nsx_python_sdk-4.0.1.0.0-py2.py3-none-any.whl"}
nsx-vmc-aws-integration-python-sdk = {url = "https://github.com/vmware/vsphere-automation-sdk-python/raw/master/lib/nsx-vmc-aws-integration-python-sdk/nsx_vmc_aws_integration_python_sdk-4.0.1.0.0-py2.py3-none-any.whl"}
nsx-vmc-policy-python-sdk = {url = "https://github.com/vmware/vsphere-automation-sdk-python/raw/master/lib/nsx-vmc-policy-python-sdk/nsx_vmc_policy_python_sdk-4.0.1.0.0-py2.py3-none-any.whl"}
vapi-client-bindings = {url = "https://github.com/vmware/vsphere-automation-sdk-python/raw/master/lib/vapi-client-bindings/vapi_client_bindings-4.0.0-py2.py3-none-any.whl"}
vmc-client-bindings = {url = "https://github.com/vmware/vsphere-automation-sdk-python/raw/master/lib/vmc-client-bindings/vmc_client_bindings-1.61.0-py2.py3-none-any.whl"}

arthurzenika avatar Dec 21 '22 13:12 arthurzenika

For those interested, I added a script in this related issue to generate this dependency list.

AnatomicJC avatar Dec 27 '23 13:12 AnatomicJC