How to

Datacenter CLI – Installation Walkthrough

Datacenter CLI (DCLI) 2.9.1 has been released and the new features are fantastic! One of the key new updates is how we install this new version of DCLI. In the past, DCLI was installed as part of vSphere CLI (vCLI). In this current version, DCLI is installed through the Python Package Index (PyPI) using pip. PyPI is the official, third-party, online repository for Python packages. Pip is a package management system which handles the installation process of Python packages from repositories like PyPI.

If you already have Python installed, version 2.7 or later, we can install DCLI with the following command:

pip install dcli

DCLI Installation Process

Let’s cover a couple scenarios where the above might not work.

Command Not Found – MacOS

MacOS comes with Python installed by default. However, this version of Python is generally used for system related tasks, isn’t up to date, and doesn’t always include pip. That means that there is a chance you could be greeted with the following:
DCLI Install - pip command not found

Installing a new, updated, version of Python is quite simple and can be done in multiple ways. My preferred way of installing Python on MacOS is with Homebrew, a widely used command line driven package manager. It can be easily downloaded and installed with the following command:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Example: Installing Homebrew

Then, we can install Python with the following command:

brew install python

Afterwards, pip will now be available and we can now easily install DCLI with the command above!

Command Not Found – Windows

Windows does not come natively with Python installed. The first step will be to download and install a supported version of Python (2.7 or better). This can be obtained from the Python Downloads page. When performing the installation, ensure the ‘Add Python x.x to PATH’ option is checked.

DCLI Installation - Python Install

Once the installation is complete, open up your favorite terminal window (I used PowerShell), and run the following command:

pip install dcli

DCLI Installation - pip install dcli

Summary

Datacenter CLI 2.9.1 greatly expands the available features and changed the installation process. This blog took a detailed look at the installation process and how to the more well-known issues people have ran into.

For more information about the DCLI 2.9.1 release, see the following vSphere blog post: New Release: VMware Datacenter CLI 2.9.1 For more specific information about, see the VMware Datacenter CLI (DCLI) User’s Guide.

Comments

6 comments have been added so far

  1. Am I the only one having issues with installing DCLI on Windows 10 (x64)?
    I have Python 3.6.5 installed and when running: ‘pip install dcli’, I always get an error which is related to pycrypto:
    Installing collected packages: werkzeug, pycrypto, dcli
    Running https://t.co/JFUGJjvQyW install for pycrypto … error
    Complete output from command c:\python36\python.exe -u -c “import setuptools, tokenize;__file__=’C:\\Users\\username\\AppData\\Local\\Temp\\pip-install-esa59duq\\pycrypto\\https://t.co/JFUGJjvQyW’;f=getattr(tokenize, ‘open’, open)(__file__);code=https://t.co/yqeoUzDJQO().replace(‘\r\n’, ‘\n’);f.close();exec(compile(code, __file__, ‘exec’))” install –record C:\Users\username\AppData\Local\Temp\pip-record-82o61fk0\install-record.txt –single-version-externally-managed –compile:

    Anyone else having the same issue?

    1. You may be hitting a dependency of the pycrypto module.

      I’ve tried to replicate a couple times. Finally, I was able to get something similar on a Win10 fresh install. However my error was as follows:
      warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
      building ‘Crypto.Random.OSRNG.winrandom’ extension
      error: Microsoft Visual C++ 14.0 is required. Get it with “Microsoft Visual C++ Build Tools”: http://landinghub.visualstudio.com/visual-cpp-build-tools

      After installing C++ 14, the install proceeded fine.

    2. I got the exacet same issue.
      compile” failed with error code 1 in c:\users\davhe\appdata\local\temp\pip-install-5hky_n\pycrypto\

      1. that was the error I received at the end after running “pip install dcli” from a powershell session.:

        “error: Microsoft Visual C++ 9.0 is required (Unable to find vcvarsall.bat). Get it from http://aka.ms/vcpython27

        After I had downloaded and instaled the “Microsoft Visual C++ Compiler for Python 2.7” from http://aka.ms/vcpython27 I was able to install the DCLI without any errors.

Leave a Reply

Your email address will not be published. Required fields are marked *