pdm-project / pdm

A modern Python package and dependency manager supporting the latest PEP standards
https://pdm-project.org
MIT License
7.55k stars 369 forks source link

vSphere SDK install fails #1716

Closed polski-g closed 1 day ago

polski-g commented 1 year ago

The vSphere automation SDK has some strange ideas in their setup.py, which is causing PDM to fail to install it.

Steps to reproduce

$ mkdir pdm-test
$ pdm init
$ pdm add -v git+https://github.com/vmware/vsphere-automation-sdk-python.git@v8.0.0.1

Actual behavior

$ pdm add -v git+https://github.com/vmware/vsphere-automation-sdk-python.git@v8.0.0.1
Adding packages to default dependencies: git+https://github.com/vmware/vsphere-automation-sdk-python.git@v8.0.0.1
STATUS: Resolving dependencies
pdm.termui: ======== Start resolving requirements ========
pdm.termui:   vSphere-Automation-SDK @ git+https://github.com/vmware/vsphere-automation-sdk-python.git@v8.0.0.1
pdm.termui:   git+https://github.com/vmware/vsphere-automation-sdk-python.git@v8.0.0.1
pdm.termui:   python>=3.9
pdm.termui:   Adding requirement vSphere-Automation-SDK @ git+https://github.com/vmware/vsphere-automation-sdk-python.git@v8.0.0.1
pdm.termui:   Adding requirement git+https://github.com/vmware/vsphere-automation-sdk-python.git@v8.0.0.1
unearth.vcs.git: Cloning https://github.com/vmware/vsphere-automation-sdk-python.git (revision: v8.0.0.1) to /tmp/pdm-build-kx5ytft5
unearth.vcs.git: Resolved https://github.com/vmware/vsphere-automation-sdk-python.git to commit a5ef74d9d91d0bc292a07ae1bb8460361b2d67e0
pdm.termui: Running PEP 517 backend to get metadata for <Link git+https://github.com/vmware/vsphere-automation-sdk-python.git@v8.0.0.1 (from None)>
pdm.termui: Preparing isolated env for PEP 517 build...
pdm.termui: ======== Start resolving requirements ========
pdm.termui:   wheel
pdm.termui:   setuptools>=40.8.0
pdm.termui:   python>=3.9.13,<3.9.14
pdm.termui:   Adding requirement wheel
pdm.termui:   Adding requirement setuptools>=40.8.0
pdm.termui:   Adding requirement python>=3.9.13,<3.9.14
pdm.termui: ======== Starting round 0 ========
pdm.termui: Pinning: python None
pdm.termui: ======== Ending round 0 ========
pdm.termui: ======== Starting round 1 ========
pdm.termui: Pinning: setuptools 67.3.2
pdm.termui: ======== Ending round 1 ========
pdm.termui: ======== Starting round 2 ========
pdm.termui: Pinning: wheel 0.38.4
pdm.termui: ======== Ending round 2 ========
pdm.termui: ======== Starting round 3 ========
pdm.termui: ======== Resolution Result ========
pdm.termui: Stable pins:
pdm.termui:       python None
pdm.termui:   setuptools 67.3.2
pdm.termui:        wheel 0.38.4
pdm.termui: Installing setuptools 67.3.2
unearth.preparer: Using cached <Link https://files.pythonhosted.org/packages/86/7b/f35d72b7a6acbc27732e88d7ceb7f224b3e0683bf645e1c9e2ac2cd96c0d/setuptools-67.3.2-py3-none-any.whl (from https://pypi.org/simple/setuptools/)>
pdm.termui: Installing wheel 0.38.4
unearth.preparer: Using cached <Link https://files.pythonhosted.org/packages/bd/7c/d38a0b30ce22fc26ed7dbc087c6d00851fb3395e9d0dac40bec1f905030c/wheel-0.38.4-py3-none-any.whl (from https://pypi.org/simple/wheel/)>
pdm.termui: running egg_info
pdm.termui: creating vSphere_Automation_SDK.egg-info
pdm.termui: writing vSphere_Automation_SDK.egg-info/PKG-INFO
pdm.termui: writing dependency_links to vSphere_Automation_SDK.egg-info/dependency_links.txt
pdm.termui: writing requirements to vSphere_Automation_SDK.egg-info/requires.txt
pdm.termui: writing top-level names to vSphere_Automation_SDK.egg-info/top_level.txt
pdm.termui: writing manifest file 'vSphere_Automation_SDK.egg-info/SOURCES.txt'
pdm.termui: reading manifest file 'vSphere_Automation_SDK.egg-info/SOURCES.txt'
pdm.termui: adding license file 'LICENSE'
pdm.termui: writing manifest file 'vSphere_Automation_SDK.egg-info/SOURCES.txt'
pdm.termui: running dist_info
pdm.termui: creating /tmp/pdm-meta-841yu8ul/vSphere_Automation_SDK.egg-info
pdm.termui: writing /tmp/pdm-meta-841yu8ul/vSphere_Automation_SDK.egg-info/PKG-INFO
pdm.termui: writing dependency_links to /tmp/pdm-meta-841yu8ul/vSphere_Automation_SDK.egg-info/dependency_links.txt
pdm.termui: writing requirements to /tmp/pdm-meta-841yu8ul/vSphere_Automation_SDK.egg-info/requires.txt
pdm.termui: writing top-level names to /tmp/pdm-meta-841yu8ul/vSphere_Automation_SDK.egg-info/top_level.txt
pdm.termui: writing manifest file '/tmp/pdm-meta-841yu8ul/vSphere_Automation_SDK.egg-info/SOURCES.txt'
pdm.termui: reading manifest file '/tmp/pdm-meta-841yu8ul/vSphere_Automation_SDK.egg-info/SOURCES.txt'
pdm.termui: adding license file 'LICENSE'
pdm.termui: writing manifest file '/tmp/pdm-meta-841yu8ul/vSphere_Automation_SDK.egg-info/SOURCES.txt'
pdm.termui: creating '/tmp/pdm-meta-841yu8ul/vSphere_Automation_SDK-1.80.0.dist-info'
pdm.termui:   Adding requirement python>=3.9
pdm.termui: ======== Starting round 0 ========
STATUS: Resolving: new pin python>=3.9
pdm.termui: Pinning: python None
pdm.termui: ======== Ending round 0 ========
pdm.termui: ======== Starting round 1 ========
pdm.termui:   Adding requirement lxml>=4.3.0(from vSphere-Automation-SDK 1.80.0)
pdm.termui:   Adding requirement pyVmomi>=6.7(from vSphere-Automation-SDK 1.80.0)
pdm.termui:   Adding requirement vapi-runtime @ file://localhost//tmp/pdm-build-kx5ytft5/lib/vapi-runtime/vapi_runtime-2.37.0-py2.py3-none-any.whl(from vSphere-Automation-SDK 1.80.0)
pdm.termui:   Adding requirement vapi-client-bindings @ file://localhost//tmp/pdm-build-kx5ytft5/lib/vapi-client-bindings/vapi_client_bindings-4.0.0-py2.py3-none-any.whl(from vSphere-Automation-SDK 1.80.0)
pdm.termui:   Adding requirement vapi-common-client @ file://localhost//tmp/pdm-build-kx5ytft5/lib/vapi-common-client/vapi_common_client-2.37.0-py2.py3-none-any.whl(from vSphere-Automation-SDK 1.80.0)
pdm.termui:   Adding requirement vmc-client-bindings @ file://localhost//tmp/pdm-build-kx5ytft5/lib/vmc-client-bindings/vmc_client_bindings-1.61.0-py2.py3-none-any.whl(from vSphere-Automation-SDK 1.80.0)
pdm.termui:   Adding requirement nsx-python-sdk @ file://localhost//tmp/pdm-build-kx5ytft5/lib/nsx-python-sdk/nsx_python_sdk-4.0.1.0.0-py2.py3-none-any.whl(from vSphere-Automation-SDK 1.80.0)
pdm.termui:   Adding requirement nsx-policy-python-sdk @ file://localhost//tmp/pdm-build-kx5ytft5/lib/nsx-policy-python-sdk/nsx_policy_python_sdk-4.0.1.0.0-py2.py3-none-any.whl(from vSphere-Automation-SDK 1.80.0)
pdm.termui:   Adding requirement nsx-vmc-policy-python-sdk @ file://localhost//tmp/pdm-build-kx5ytft5/lib/nsx-vmc-policy-python-sdk/nsx_vmc_policy_python_sdk-4.0.1.0.0-py2.py3-none-any.whl(from vSphere-Automation-SDK 1.80.0)
pdm.termui:   Adding requirement nsx-vmc-aws-integration-python-sdk @ file://localhost//tmp/pdm-build-kx5ytft5/lib/nsx-vmc-aws-integration-python-sdk/nsx_vmc_aws_integration_python_sdk-4.0.1.0.0-py2.py3-none-any.whl(from vSphere-Automation-SDK 1.80.0)
pdm.termui:   Adding requirement vmc-draas-client-bindings @ file://localhost//tmp/pdm-build-kx5ytft5/lib/vmc-draas-client-bindings/vmc_draas_client_bindings-1.20.0-py2.py3-none-any.whl(from vSphere-Automation-SDK 1.80.0)
STATUS: Resolving: new pin vSphere-Automation-SDK 1.80.0
pdm.termui: Pinning: vSphere-Automation-SDK 1.80.0
pdm.termui: ======== Ending round 1 ========
pdm.termui: ======== Starting round 2 ========
unearth.vcs.git: Cloning https://github.com/vmware/vsphere-automation-sdk-python.git (revision: v8.0.0.1) to /tmp/pdm-build-n41mvnup
unearth.vcs.git: Resolved https://github.com/vmware/vsphere-automation-sdk-python.git to commit a5ef74d9d91d0bc292a07ae1bb8460361b2d67e0
pdm.termui: Running PEP 517 backend to get metadata for <Link git+https://github.com/vmware/vsphere-automation-sdk-python.git@v8.0.0.1 (from None)>
pdm.termui: Preparing isolated env for PEP 517 build...
pdm.termui: running egg_info
pdm.termui: creating vSphere_Automation_SDK.egg-info
pdm.termui: writing vSphere_Automation_SDK.egg-info/PKG-INFO
pdm.termui: writing dependency_links to vSphere_Automation_SDK.egg-info/dependency_links.txt
pdm.termui: writing requirements to vSphere_Automation_SDK.egg-info/requires.txt
pdm.termui: writing top-level names to vSphere_Automation_SDK.egg-info/top_level.txt
pdm.termui: writing manifest file 'vSphere_Automation_SDK.egg-info/SOURCES.txt'
pdm.termui: reading manifest file 'vSphere_Automation_SDK.egg-info/SOURCES.txt'
pdm.termui: adding license file 'LICENSE'
pdm.termui: writing manifest file 'vSphere_Automation_SDK.egg-info/SOURCES.txt'
pdm.termui: running dist_info
pdm.termui: creating /tmp/pdm-meta-zpm3ps80/vSphere_Automation_SDK.egg-info
pdm.termui: writing /tmp/pdm-meta-zpm3ps80/vSphere_Automation_SDK.egg-info/PKG-INFO
pdm.termui: writing dependency_links to /tmp/pdm-meta-zpm3ps80/vSphere_Automation_SDK.egg-info/dependency_links.txt
pdm.termui: writing requirements to /tmp/pdm-meta-zpm3ps80/vSphere_Automation_SDK.egg-info/requires.txt
pdm.termui: writing top-level names to /tmp/pdm-meta-zpm3ps80/vSphere_Automation_SDK.egg-info/top_level.txt
pdm.termui: writing manifest file '/tmp/pdm-meta-zpm3ps80/vSphere_Automation_SDK.egg-info/SOURCES.txt'
pdm.termui: reading manifest file '/tmp/pdm-meta-zpm3ps80/vSphere_Automation_SDK.egg-info/SOURCES.txt'
pdm.termui: adding license file 'LICENSE'
pdm.termui: writing manifest file '/tmp/pdm-meta-zpm3ps80/vSphere_Automation_SDK.egg-info/SOURCES.txt'
pdm.termui: creating '/tmp/pdm-meta-zpm3ps80/vSphere_Automation_SDK-1.80.0.dist-info'
pdm.termui:   Adding requirement lxml>=4.3.0(from vSphere-Automation-SDK 1.80.0)
pdm.termui:   Adding requirement pyVmomi>=6.7(from vSphere-Automation-SDK 1.80.0)
pdm.termui:   Adding requirement vapi-runtime @ file://localhost//tmp/pdm-build-n41mvnup/lib/vapi-runtime/vapi_runtime-2.37.0-py2.py3-none-any.whl(from vSphere-Automation-SDK 1.80.0)
pdm.termui: Candidate rejected: vSphere-Automation-SDK@git+https://github.com/vmware/vsphere-automation-sdk-python.git@v8.0.0.1 because it introduces a new requirement vapi-runtime @ file://localhost//tmp/pdm-build-n41mvnup/lib/vapi-runtime/vapi_runtime-2.37.0-py2.py3-none-any.whl that conflicts with other requirements:
    vapi-runtime @ file://localhost//tmp/pdm-build-kx5ytft5/lib/vapi-runtime/vapi_runtime-2.37.0-py2.py3-none-any.whl (from vSphere-Automation-SDK@git+https://github.com/vmware/vsphere-automation-sdk-python.git@v8.0.0.1)
pdm.termui: Conflicts detected: 
  vapi-runtime @ file://localhost//tmp/pdm-build-kx5ytft5/lib/vapi-runtime/vapi_runtime-2.37.0-py2.py3-none-any.whl (from vSphere-Automation-SDK@git+https://github.com/vmware/vsphere-automation-sdk-python.git@v8.0.0.1)
  vapi-runtime @ file://localhost//tmp/pdm-build-n41mvnup/lib/vapi-runtime/vapi_runtime-2.37.0-py2.py3-none-any.whl (from vSphere-Automation-SDK@git+https://github.com/vmware/vsphere-automation-sdk-python.git@v8.0.0.1)
🔒 Lock failed
Unable to find a resolution for vapi-runtime
because of the following conflicts:
  vapi-runtime @ file://localhost//tmp/pdm-build-kx5ytft5/lib/vapi-runtime/vapi_runtime-2.37.0-py2.py3-none-any.whl (from vSphere-Automation-SDK@git+https://github.com/vmware/vsphere-automation-sdk-python.git@v8.0.0.1)
  vapi-runtime @ file://localhost//tmp/pdm-build-n41mvnup/lib/vapi-runtime/vapi_runtime-2.37.0-py2.py3-none-any.whl (from vSphere-Automation-SDK@git+https://github.com/vmware/vsphere-automation-sdk-python.git@v8.0.0.1)
To fix this, you could loosen the dependency version constraints in pyproject.toml. See https://pdm.fming.dev/latest/usage/dependency/#solve-the-locking-failure for more details.
Traceback (most recent call last):
  File "...../bin/pdm", line 8, in <module>
    sys.exit(main())
  File "...../pipx/venvs/pdm/lib64/python3.10/site-packages/pdm/core.py", line 259, in main
    return Core().main(args)
  File "...../pipx/venvs/pdm/lib64/python3.10/site-packages/pdm/core.py", line 191, in main
    raise cast(Exception, err).with_traceback(traceback)
  File "...../pipx/venvs/pdm/lib64/python3.10/site-packages/pdm/core.py", line 186, in main
    f(project, options)
  File "...../pipx/venvs/pdm/lib64/python3.10/site-packages/pdm/cli/commands/add.py", line 58, in handle
    actions.do_add(
  File "...../pipx/venvs/pdm/lib64/python3.10/site-packages/pdm/cli/actions.py", line 288, in do_add
    resolved = do_lock(
  File "...../pipx/venvs/pdm/lib64/python3.10/site-packages/pdm/cli/actions.py", line 117, in do_lock
    raise ResolutionImpossible("Unable to find a resolution") from None
resolvelib.resolvers.ResolutionImpossible: Unable to find a resolution

Expected behavior

Install the binary wheel files referenced by the vsphere SDK.

Environment Information

$ pdm info && pdm info --env
PDM version:
  2.4.5
Python Interpreter:
  /tmp/pdm-test/.venv/bin/python (3.9)
Project Root:
  /tmp/pdm-test
Project Packages:
  None
{
  "implementation_name": "cpython",
  "implementation_version": "3.9.13",
  "os_name": "posix",
  "platform_machine": "x86_64",
  "platform_release": "6.1.7-100.fc36.x86_64",
  "platform_system": "Linux",
  "platform_version": "#1 SMP PREEMPT_DYNAMIC Wed Jan 18 18:37:43 UTC 2023",
  "python_full_version": "3.9.13",
  "platform_python_implementation": "CPython",
  "python_version": "3.9",
  "sys_platform": "linux"
}
jkrgr0 commented 2 months ago

Not really a solution for the problem, but I was able to add the vSphere Automation SDK by downloading the repository (git submodule or zip and extract) as a subfolder in the project dir and then adding all components manually:

  1. Add all the wheel files from the SDK's lib directory.

    pdm add ./vsphere-automation-sdk-python/lib/vapi-runtime/vapi_runtime-2.44.0-py2.py3-none-any.whl
    pdm add ./vsphere-automation-sdk-python/lib/vcenter-bindings/vcenter_bindings-4.2.0-py2.py3-none-any.whl
    pdm add ./vsphere-automation-sdk-python/lib/vapi-common-client/vapi_common_client-2.44.0-py2.py3-none-any.whl
    pdm add ./vsphere-automation-sdk-python/lib/vmwarecloud-aws/vmwarecloud_aws-1.64.0-py2.py3-none-any.whl 
    pdm add ./vsphere-automation-sdk-python/lib/nsx-python-sdk/nsx_python_sdk-4.1.2.0.0-py2.py3-none-any.whl 
    pdm add ./vsphere-automation-sdk-python/lib/nsx-policy-python-sdk/nsx_policy_python_sdk-4.1.2.0.0-py2.py3-none-any.whl 
    pdm add ./vsphere-automation-sdk-python/lib/nsx-vmc-policy-python-sdk/nsx_vmc_policy_python_sdk-4.1.2.0.0-py2.py3-none-any.whl 
    pdm add ./vsphere-automation-sdk-python/lib/nsx-vmc-aws-integration-python-sdk/nsx_vmc_aws_integration_python_sdk-4.1.2.0.0-py2.py3-none-any.whl 
    pdm add ./vsphere-automation-sdk-python/lib/vmwarecloud-draas/vmwarecloud_draas-1.23.0-py2.py3-none-any.whl
  2. Add all other requirements from ./vsphere-automation-sdk-python/requirements.txt (without the SDK properties).

    pdm add "lxml>=4.3.0" "pyVmomi>=6.7" "six>=1.12" "requests>=2.27.1" "pyOpenSSL>=22.0.0" "cryptography>=37.0.2"