Installing the Client
Installation Options
When preparing your computer for installing the CLI, you should have decided which of the three installation options you want to pursue. The options are:
- Adding the CLI to a system-wide Python installation. This is only possible if you have sufficient permissions to do so, and runs the risk of altering the system-wide Python in ways that could affect other users.
- Installing the CLI in your user location to work with a system-wide Python. This approach should always be available to you and ensures that installing the CLI will not affect other users.
- Creating a virtual environment for the CLI and installing it there. Creating a virtual environment for the CLI involves more work, but allows you to isolate its installation from that of your other Python projects.
Depending on the installation type you have chosen, follow the instructions in the appropriate section below. These instructions will install the latest version of the client, which is recommended as all clients are backwards compatible with previous versions of OpenStack server components. After the CLI has been installed you will need to configure an openrc.sh file before using it.
Installing System-Wide
Simply execute the command:
pip3 install python-openstackclient
The CLI executables will be installed in the same system folder
that contains the python3
and pip3
commands,
which should already by in your command path.
Installing in a User Location
Installing packages to a
user location
simply requires adding the --user
option to the "pip3" command:
pip3 install --user python-openstackclient
The package will be installed under a folder named .local
in your home directory,
with the CLI commands stored in .local/bin
.
Unless you have previously installed other "user local" Python packages,
you will probably need to add this folder to your command path.
The procedures to do this are different on
Windows,
Mac
and Linux.
Installing in a Virtual Environment
There are two popular tools for creating and managing virtual environments for Python: venv and virtualenv (other tools are also available). Their basic usage is fairly similar and is introduced here. If you choose to use one of these packages for the CLI, you will need to:
- Install the package, if necessary.
- Create a new virtual environment for your CLI usage.
- Select/activate the new virtual environment.
- Install the CLI in that environment using a command from "Installing System-Wide", above.
- Select/activate the virtual environment each time you begin using the CLI.
Alternatively, if you are using conda to manage packages in the Anaconda Python Distribution, you can use conda's tools for managing virtual environments.
Once your installation is complete, you can validate it by running the command:
openstack --version