os-win

raw JSON →
5.9.0 verified Fri May 01 auth: no python

Windows / Hyper-V library for OpenStack projects. Provides modules for managing Hyper-V virtual machines, storage, networking, and other Windows Server features. Current version 5.9.0 (requires Python >= 3.6). Released as needed for OpenStack releases.

pip install os-win
error ModuleNotFoundError: No module named 'os_win'
cause Misspelled package name: the PyPI name is 'os-win' but the import is 'os_win' (underscore instead of hyphen).
fix
Import using 'import os_win' (note the underscore).
error ImportError: cannot import name 'HyperVUtils' from 'os_win'
cause HyperVUtils is not a direct top-level module; it is located under os_win.utilsfactory.
fix
Use 'from os_win import utilsfactory' and then utilsfactory.HyperVUtils().
error OSError: [WinError 5] Access is denied
cause Insufficient permissions. Hyper-V management requires administrator rights.
fix
Run Python as Administrator or ensure the user has necessary privileges.
gotcha os-win is Windows-only. Importing or using on Linux/macOS will raise ImportError or silently fail.
fix Use conditional imports or run only on Windows.
gotcha Most methods require administrator privileges on Windows. Running without elevated rights will raise exceptions.
fix Run Python with 'Run as administrator' or ensure the user is in the Hyper-V Administrators group.
deprecated The old import path 'from os_win import _utils' is deprecated and may be removed in future versions.
fix Use the official public API: from os_win import utilsfactory or from os_win.utils import *
pip install os-win[hyperv]

Basic usage: create a factory instance and call common methods (requires admin privileges on Windows).

from os_win import utilsfactory

# Initialize utils using the factory
utils = utilsfactory.HyperVUtils()
print(utils.get_host_info())
print(utils.list_instances())