ImageBuilder PowerCLI cmdlets fail to import a module
search cancel

ImageBuilder PowerCLI cmdlets fail to import a module

book

Article ID: 313376

calendar_today

Updated On:

Products

VMware vSphere ESXi

Issue/Introduction

Symptoms:

Invoking a cmdlet from the ImageBuilder PowerCLI module fails with error: ModuleNotFoundError: No module named 'vmware.esximage'


Cause

A python file is missed in the final distribution. This file marks a directory as a python module. It is not mandatory to have but if conditions align and there is already a module with the same name on the system, the files in the module that is being distributed with ImageBuilder end up being undiscoverable.

Resolution

Currently there is no resolution. This will be fixed in the future release.


Workaround:

To workaround the issue, please follow the below mentioned steps:

Add an empty file with a specific name to a directory within the ImageBuilder PowerCLI module.

  1. Identify the directory where PowerCLI is located.
1.1. The contents of the $env:PSModulePath environment variable will hold the locations used for module lookup.
  1. Navigate to the VMware.ImageBuilder PowerCLI module.
  2. Navigate to the directory starting with "8.0".
  3. Navigate to the proper .net directory.
4.1. Navigate to net45 in case of Windows.
4.2. Navigate to netcoreapp2.0 in case of Mac or Linux.
  1. Navigate to server/vmware.
  2. Create an empty file with the name __init__.py
  3. Restart PowerShell.