vmware / vsphere-automation-sdk-python

Python samples, language bindings, and API reference documentation for vSphere, VMC, and NSX-T using the VMware REST API
MIT License
747 stars 313 forks source link

Problem installing the sdk with the latest setuptools version: 61.0.0 #303

Closed dgrandt closed 2 years ago

dgrandt commented 2 years ago

Describe the bug

I get an error message while installing the sdk:

Step 6/11 : RUN pip3 install --upgrade pip setuptools
 ---> Using cache
 ---> 75458662222d
Step 7/11 : RUN pip3 install --upgrade git+https://github.com/vmware/vsphere-automation-sdk-python.git
 ---> Running in b08018f7dc9d
Collecting git+https://github.com/vmware/vsphere-automation-sdk-python.git
  Cloning https://github.com/vmware/vsphere-automation-sdk-python.git to /tmp/pip-req-build-gw9dacg8
  Running command git clone --filter=blob:none --quiet https://github.com/vmware/vsphere-automation-sdk-python.git /tmp/pip-req-build-gw9dacg8
  Resolved https://github.com/vmware/vsphere-automation-sdk-python.git to commit d8ee747115e2ad7505692723c60765824104e3b7
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'error'
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [14 lines of output]
      error: Multiple top-level packages discovered in a flat-layout: ['lib', 'samples', 'sample_template'].

      To avoid accidental inclusion of unwanted files or directories,
      setuptools will not proceed with this build.

      If you are trying to create a single distribution with multiple packages
      on purpose, you should not rely on automatic discovery.
      Instead, consider the following options:

      1. set up custom discovery (`find` directive with `include` or `exclude`)
      2. use a `src-layout`
      3. explicitly set `py_modules` or `packages` with a list of names

      To find more information, look for "package discovery" on setuptools docs.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

pip3 installs the latest version of setuptools 61.0.0

When i hardcode the setuptools version to 60.10.0, the installation is no problem.

Step 6/11 : RUN pip3 install --upgrade pip setuptools==60.10.0
 ---> Running in be9822409742
Requirement already satisfied: pip in /usr/local/lib/python3.8/site-packages (21.1.3)
Collecting pip
  Downloading pip-22.0.4-py3-none-any.whl (2.1 MB)
Collecting setuptools==60.10.0
  Downloading setuptools-60.10.0-py3-none-any.whl (1.1 MB)
Installing collected packages: setuptools, pip
  Attempting uninstall: setuptools
    Found existing installation: setuptools 41.6.0
    Uninstalling setuptools-41.6.0:
      Successfully uninstalled setuptools-41.6.0
  Attempting uninstall: pip
    Found existing installation: pip 21.1.3
    Uninstalling pip-21.1.3:
      Successfully uninstalled pip-21.1.3
Successfully installed pip-22.0.4 setuptools-60.10.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
Removing intermediate container be9822409742
 ---> e51df3c78084
Step 7/11 : RUN pip3 install --upgrade git+https://github.com/vmware/vsphere-automation-sdk-python.git
 ---> Running in 1f75f5cf4ed0
Collecting git+https://github.com/vmware/vsphere-automation-sdk-python.git
  Cloning https://github.com/vmware/vsphere-automation-sdk-python.git to /tmp/pip-req-build-lcie6y5y
  Running command git clone --filter=blob:none --quiet https://github.com/vmware/vsphere-automation-sdk-python.git /tmp/pip-req-build-lcie6y5y
  Resolved https://github.com/vmware/vsphere-automation-sdk-python.git to commit d8ee747115e2ad7505692723c60765824104e3b7
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Processing //tmp/pip-req-build-lcie6y5y/lib/vapi-runtime/vapi_runtime-2.30.0-py2.py3-none-any.whl
Processing //tmp/pip-req-build-lcie6y5y/lib/vapi-client-bindings/vapi_client_bindings-3.7.0-py2.py3-none-any.whl
Processing //tmp/pip-req-build-lcie6y5y/lib/vapi-common-client/vapi_common_client-2.30.0-py2.py3-none-any.whl
Processing //tmp/pip-req-build-lcie6y5y/lib/vmc-client-bindings/vmc_client_bindings-1.57.0-py2.py3-none-any.whl
Processing //tmp/pip-req-build-lcie6y5y/lib/nsx-python-sdk/nsx_python_sdk-3.1.3.2.0-py2.py3-none-any.whl
Processing //tmp/pip-req-build-lcie6y5y/lib/nsx-policy-python-sdk/nsx_policy_python_sdk-3.1.3.2.0-py2.py3-none-any.whl
Processing //tmp/pip-req-build-lcie6y5y/lib/nsx-vmc-policy-python-sdk/nsx_vmc_policy_python_sdk-3.1.3.2.0-py2.py3-none-any.whl
Processing //tmp/pip-req-build-lcie6y5y/lib/nsx-vmc-aws-integration-python-sdk/nsx_vmc_aws_integration_python_sdk-3.1.3.2.0-py2.py3-none-any.whl
Processing //tmp/pip-req-build-lcie6y5y/lib/vmc-draas-client-bindings/vmc_draas_client_bindings-1.18.0-py2.py3-none-any.whl
Requirement already satisfied: lxml>=4.3.0 in /usr/lib64/python3.8/site-packages (from vSphere-Automation-SDK==1.74.0) (4.4.1)
Requirement already satisfied: pyVmomi>=6.7 in /usr/local/lib/python3.8/site-packages (from vSphere-Automation-SDK==1.74.0) (7.0.2)
Requirement already satisfied: six>=1.7.3 in /usr/lib/python3.8/site-packages (from pyVmomi>=6.7->vSphere-Automation-SDK==1.74.0) (1.12.0)
Requirement already satisfied: requests>=2.3.0 in /usr/lib/python3.8/site-packages (from pyVmomi>=6.7->vSphere-Automation-SDK==1.74.0) (2.22.0)
Requirement already satisfied: setuptools in /usr/local/lib/python3.8/site-packages (from vapi-runtime@ file://localhost//tmp/pip-req-build-lcie6y5y/lib/vapi-runtime/vapi_runtime-2.30.0-py2.py3-none-any.whl->vSphere-Automation-SDK==1.74.0) (60.10.0)
Requirement already satisfied: pyOpenSSL>=18.0.0 in /usr/local/lib/python3.8/site-packages (from vapi-runtime@ file://localhost//tmp/pip-req-build-lcie6y5y/lib/vapi-runtime/vapi_runtime-2.30.0-py2.py3-none-any.whl->vSphere-Automation-SDK==1.74.0) (19.1.0)
Requirement already satisfied: cryptography>=2.8 in /usr/lib64/python3.8/site-packages (from pyOpenSSL>=18.0.0->vapi-runtime@ file://localhost//tmp/pip-req-build-lcie6y5y/lib/vapi-runtime/vapi_runtime-2.30.0-py2.py3-none-any.whl->vSphere-Automation-SDK==1.74.0) (2.8)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/lib/python3.8/site-packages (from requests>=2.3.0->pyVmomi>=6.7->vSphere-Automation-SDK==1.74.0) (3.0.4)
Requirement already satisfied: idna<2.9,>=2.5 in /usr/lib/python3.8/site-packages (from requests>=2.3.0->pyVmomi>=6.7->vSphere-Automation-SDK==1.74.0) (2.8)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/lib/python3.8/site-packages (from requests>=2.3.0->pyVmomi>=6.7->vSphere-Automation-SDK==1.74.0) (1.25.7)
Requirement already satisfied: cffi!=1.11.3,>=1.8 in /usr/lib64/python3.8/site-packages (from cryptography>=2.8->pyOpenSSL>=18.0.0->vapi-runtime@ file://localhost//tmp/pip-req-build-lcie6y5y/lib/vapi-runtime/vapi_runtime-2.30.0-py2.py3-none-any.whl->vSphere-Automation-SDK==1.74.0) (1.13.2)
Requirement already satisfied: pycparser in /usr/lib/python3.8/site-packages (from cffi!=1.11.3,>=1.8->cryptography>=2.8->pyOpenSSL>=18.0.0->vapi-runtime@ file://localhost//tmp/pip-req-build-lcie6y5y/lib/vapi-runtime/vapi_runtime-2.30.0-py2.py3-none-any.whl->vSphere-Automation-SDK==1.74.0) (2.19)
Using legacy 'setup.py install' for vSphere-Automation-SDK, since package 'wheel' is not installed.
Installing collected packages: vapi-runtime, vapi-common-client, vapi-client-bindings, vmc-draas-client-bindings, vmc-client-bindings, nsx-vmc-policy-python-sdk, nsx-vmc-aws-integration-python-sdk, nsx-python-sdk, nsx-policy-python-sdk, vSphere-Automation-SDK
  Attempting uninstall: vapi-runtime
    Found existing installation: vapi-runtime 2.25.0
    Uninstalling vapi-runtime-2.25.0:
      Successfully uninstalled vapi-runtime-2.25.0
  Attempting uninstall: vapi-common-client
    Found existing installation: vapi-common-client 2.25.0
    Uninstalling vapi-common-client-2.25.0:
      Successfully uninstalled vapi-common-client-2.25.0
  Attempting uninstall: vapi-client-bindings
    Found existing installation: vapi-client-bindings 3.6.0
    Uninstalling vapi-client-bindings-3.6.0:
      Successfully uninstalled vapi-client-bindings-3.6.0
  Attempting uninstall: vmc-draas-client-bindings
    Found existing installation: vmc-draas-client-bindings 1.17.0
    Uninstalling vmc-draas-client-bindings-1.17.0:
      Successfully uninstalled vmc-draas-client-bindings-1.17.0
  Attempting uninstall: vmc-client-bindings
    Found existing installation: vmc-client-bindings 1.45.0
    Uninstalling vmc-client-bindings-1.45.0:
      Successfully uninstalled vmc-client-bindings-1.45.0
  Attempting uninstall: nsx-vmc-policy-python-sdk
    Found existing installation: nsx-vmc-policy-python-sdk 3.1.2.1.1
    Uninstalling nsx-vmc-policy-python-sdk-3.1.2.1.1:
      Successfully uninstalled nsx-vmc-policy-python-sdk-3.1.2.1.1
  Attempting uninstall: nsx-vmc-aws-integration-python-sdk
    Found existing installation: nsx-vmc-aws-integration-python-sdk 3.1.2.1.1
    Uninstalling nsx-vmc-aws-integration-python-sdk-3.1.2.1.1:
      Successfully uninstalled nsx-vmc-aws-integration-python-sdk-3.1.2.1.1
  Attempting uninstall: nsx-python-sdk
    Found existing installation: nsx-python-sdk 3.1.2.1.1
    Uninstalling nsx-python-sdk-3.1.2.1.1:
      Successfully uninstalled nsx-python-sdk-3.1.2.1.1
  Attempting uninstall: nsx-policy-python-sdk
    Found existing installation: nsx-policy-python-sdk 3.1.2.1.1
    Uninstalling nsx-policy-python-sdk-3.1.2.1.1:
      Successfully uninstalled nsx-policy-python-sdk-3.1.2.1.1
  Attempting uninstall: vSphere-Automation-SDK
    Found existing installation: vSphere-Automation-SDK 1.61.0
    Uninstalling vSphere-Automation-SDK-1.61.0:
      Successfully uninstalled vSphere-Automation-SDK-1.61.0
  Running setup.py install for vSphere-Automation-SDK: started
  Running setup.py install for vSphere-Automation-SDK: finished with status 'done'
Successfully installed nsx-policy-python-sdk-3.1.3.2.0 nsx-python-sdk-3.1.3.2.0 nsx-vmc-aws-integration-python-sdk-3.1.3.2.0 nsx-vmc-policy-python-sdk-3.1.3.2.0 vSphere-Automation-SDK vapi-client-bindings-3.7.0 vapi-common-client-2.30.0 vapi-runtime-2.30.0 vmc-client-bindings-1.57.0 vmc-draas-client-bindings-1.18.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
Removing intermediate container 1f75f5cf4ed0
 ---> 13d896f8883b
Step 8/11 : RUN echo "runner ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
 ---> Running in e28721c14a30
Removing intermediate container e28721c14a30
 ---> c4815971ed34
Step 9/11 : RUN echo "runner:*:17532:0:99999:7:::" >> /etc/shadow
 ---> Running in 7d9e43c663ac
Removing intermediate container 7d9e43c663ac
 ---> 821966462bff
Step 10/11 : RUN ansible --version
 ---> Running in eeabb74a32e7
ansible [core 2.11.2.post0]
  config file = None
  configured module search path = ['/home/runner/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.8/site-packages/ansible
  ansible collection location = /home/runner/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.8.8 (default, Aug 25 2021, 16:13:02) [GCC 8.5.0 20210514 (Red Hat 8.5.0-3)]
  jinja version = 2.10.3
  libyaml = True
Removing intermediate container eeabb74a32e7
 ---> b3e0a07385ab
Step 11/11 : USER 1000:0
 ---> Running in cd6e4309d8c5
Removing intermediate container cd6e4309d8c5
 ---> 6a7cd10099e1
Successfully built 6a7cd10099e1
Successfully tagged awx-test:latest

Reproduction steps

1. pip3 install --upgrade pip setuptools
2. pip3 install --upgrade git+https://github.com/vmware/vsphere-automation-sdk-python.git

Expected behavior

Install the sdk without any problems like in the past

Additional context

The latest setuptools version 61.0.0 seems to have a problem with the package.

777GE90 commented 2 years ago

Same, using an older version of setuptools works fine.

For version 61.0.0, seems like this can be fixed by updating the setup.py file to include:

     ...
     py_modules=["lib"],
     ...
StuckinVim-Forever commented 2 years ago

facing the same issue here

recklessop commented 2 years ago

Same issue here too

shwetapurohit commented 2 years ago

There is issue that has been reported in github setuptools, Further there was new release yesterday 62.0.0 , but that is also resulting same error I've reported the issue in github/setuptools

https://github.com/pypa/setuptools/issues/3227

https://github.com/pypa/setuptools/issues/3198

Aref-Riant commented 2 years ago

Running pip install --upgrade setuptools==60.10.0 Helped me to resolve the problem.

bb-Ricardo commented 2 years ago

Any updates on this?

shwetapurohit commented 2 years ago

@bb-Ricardo Issue has been fixed. Further if you face any issues, please feel free to raise .

Thanks, Shweta