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
745 stars 313 forks source link

ModuleNotFoundError: No module named 'vmware.vapi'; 'vmware' is not a package #420

Closed ThiBot77 closed 5 months ago

ThiBot77 commented 5 months ago

Describe the bug

Hello,

I'm experiencing a problem following installation via typical installation and a code execution test.

I get a module not found error image

I don't think I'm missing anything, I'm experiencing this problem on my Windows PC and my Linux server. image

I tried the command set PYTHONPATH=%cd%;%PYTHONPATH%

It didn't change anything

Thank you for you help

Reproduction steps

  1. pip install --upgrade pip
  2. pip install --upgrade setuptools
  3. pip install --upgrade git+https://github.com/vmware/vsphere-automation-sdk-python.git
  4. set PYTHONPATH=%cd%;%PYTHONPATH%
  5. Launch code template "Connect to a vCenter Server"

Expected behavior

I'd like to launch my code

Additional context

No response

shwetapurohit commented 5 months ago

@ThiBot77 Please try the installation steps after the python virtual environment is setup. Here is the step - https://github.com/vmware/vsphere-automation-sdk-python?tab=readme-ov-file#prepare-a-python-development-environment

ThiBot77 commented 5 months ago

@ThiBot77 Veuillez essayer les étapes d'installation une fois l'environnement virtuel Python configuré. Voici l'étape - https://github.com/vmware/vsphere-automation-sdk-python?tab=readme-ov-file#prepare-a-python-development-environment

Thanks for your help, I've already tried this method and I'm having the same problem.

kunalpmj commented 5 months ago

is python not included in the PATH? wondering why you need to give the absolute path to python.exe? and what is this vmware.py? if this is one of your files then rename it to something else, it is conflicting with the package name "vmware"

ThiBot77 commented 5 months ago

is python not included in the PATH? wondering why you need to give the absolute path to python.exe? and what is this vmware.py? if this is one of your files then rename it to something else, it is conflicting with the package name "vmware"

Hi, thank you for your help.

Stupid me, my code file had the same name as the vmware module. Renaming corrected the problem