Comparison of Python VMware vSphere client libraries

I recently had the need to manage VMware vSphere from Python code so I went about looking for examples and open source libraries. The vCenter management server has a SOAP web service that exposes most (if not all) of the administrative capabilities that you can perform on vSphere. At first thought, this seemed like a simple endeavor. However once I got into it I found it not as simple as interacting with a RESTful web service.

The first thing I had to do is setup a vSphere test environment. More details on this in another blog post, but basically I created a login at My VMware and downloaded a 60 day trial of the vSphere hypervisor and vCenter.

Next I went searching for Python client libraries for the vSphere SOAP web service.

Here is a summary of what I found:

  • psphere – pure Python library  for the vSphere SDK by Jonathan Kinred
  • pyvisdk – pure Python library  for the vSphere SDK by Eric Plaster
  • pysphere – pure Python library  for the vSphere SDK by Sebastian Tello
  • vijava – vSphere Java api by Steve Jin extended to Python with the Jython interpreter

Here are some details on each:




irc: #psphere on Freenode

mailing list or forum:!forum/psphere

Psphere is a pure Python library which uses the Suds client Python library to communicate via SOAP. It is actively maintained with activity picking up the summer of 2012. Recently moved from Bitbucket to Github which is nice. Also recently create an irc channel on freenode. Apache 2.0 license.


  • Actively maintained
  • Good author response, acknowledges shortcomings and wants to work with the community to resolve them
  • Very easy to work with
  • Fast once initial connection is made
  • Decent user base


  • “Compiles” WDSL on every connection made
  • CPU and memory footprint is large (see benchmarks)
  • Need more and more examples




irc: n/a

mailing list or forum: none I could find

Another pure Python library that uses Suds for the SOAP client. The author recognizes psphere for giving him some idea on how to communicate with vSphere. Also on Github. MIT license. Also actively maintained.


  • Pretty easy to code with


  • “Compiles” WDSL on every connection made
  • Slowest of the pure Python libraries
  • Really high memory and cpu footprint




irc: n/a

mailing list or forum:!forum/pysphere

Pysphere seems to be the oldest of the pure Python libraries, released into the open source world in 2011. It uses a fork of the ZSI Soap library for the Soap client layer. Seems to be actively maintained. Source is on the Google Code site which (is less than optimal for forking). BSD license.


  • Actively maintained
  • Pretty easy to work with
  • Fastest of the pure Python libraries
  • Lowest memory and cpu footprint


  • “Compiles” WDSL on every connection made




irc: n/a

mailing list or forum:

Vijava is actually a Java library that utilizes the VMware vSphere Java SDK to communicate with the web service. Vijava was created by Steve Jin while he was at VMware Labs, though the project is not officially supported by VMware.

The interesting thing is that the SOAP WSDL is “pre-loaded” as code so that it doesn’t need to be compiled at runtime. You can write Python scripts which calls vijava using the Jython interpreter. This library seems to have the largest user base but code commits are made much less frequently, usually to coincide with vSphere releases. License BSD.


  • Fast, once the Java interpreter is running
  • Good for longer running processes


  • Java interpreter is slow (IMHO) to start up
  • Not so good for small scripts or single API calls
  • Non-python software to install and configure: Java Runtime Environment, Jython
  • Have to have your Java class path set up “just right”


Let look at some sample code for each, performing the same exact task. Each script will establish a connection to the vCenter server, retrieve a list of virtual machines and  print some properties.

psphere – 0.5.2

from psphere.client import Client

from psphere.managedobjects import VirtualMachine
client = Client(“”, “root”, “vmware”)
vms = VirtualMachine.all(client)
for x in vms:
    print x.config.guestFullName,, x.overallStatus, x.config.template

pyvisdk – 0.9.20

from pyvisdk.vim import Vim

server = Vim(server=”″)
vms = server.getVirtualMachines()
for x in vms:
print x.config.guestFullName,, x.overallStatus, x.config.template

pysphere – 0.1.6

from pysphere import VIServer

server = VIServer()
server.connect(“”, “root”, “vmware”)
vms = server.get_registered_vms()
for x in vms:
vm = server.get_vm_by_path(x)
print,, \,

vijava – 5.0.1

import sys
sys.path.insert(0, ‘/usr/local/lib/vijava/vijava50120120518.jar’)
sys.path.insert(0, ‘/usr/local/lib/vijava/dom4j-1.6.1.jar’)
from import URL
from import *
server = ServiceInstance(URL(“”),”root”,”vmware”, True)
rootFolder = server.getRootFolder()
vms = InventoryNavigator(rootFolder).searchManagedEntities(“VirtualMachine”);
for x in vms:
print x.config.guestFullName,, x.overallStatus, x.config.template

I tested the above scripts on OSX going against the vCenter appliance running inside Virtual Box. The ESX server is on the local network. There are two virtual machines returned in the results.
psphere – 8 seconds, 160M memory used
pyvisdk – 11 seconds, 550M memory
pysphere – 2 seconds, 50M memory
vijava –  5 seconds, 130M memory
Pysphere would seem to win the race. When I get time I will dig deeper into why the results are what they are. In the meantime please share your thoughts.
Leave a comment


  1. This posting seems to support the conclusion that pysphere is the library to use:

  2. Rothwerx

     /  May 17, 2013

    Thanks for this. I just wish I had seen this before I gave up and decided to use the Perl SDK.

  3. Rangu

     /  August 7, 2013

    pysphere does not seem to support creation of VMs.

  4. There is also the VMware provided Python SDK for vSphere call pyVmomi

    • I had noticed that recently (it’s fairly new, newer than the blog post) but haven’t played with it at all.

  1. PySphere’s Missing Pieces | Snapfiber

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: