Upgrade the Linode CLI to use Python 3

Traducciones al Español
Estamos traduciendo nuestros guías y tutoriales al Español. Es posible que usted esté viendo una traducción generada automáticamente. Estamos trabajando con traductores profesionales para verificar las traducciones de nuestro sitio web. Este proyecto es un trabajo en curso.
Create a Linode account to try this guide with a $100 credit.
This credit will be applied to any valid services used during your first 60 days.

In This Guide

At the time of this writing, the Linode CLI is currently able to be fully supported by both Python 2.x and Python 3.x depending on user preference and needs. That being said, as Python 2 has reached it’s end-of-life in early 2020, it is strongly recommended that users upgrade to the latest version of the CLI supported by python3 as soon as they are able.

In this guide, steps are provided to uninstall the version of the Linode CLI that relies on Python 2, and immediately replace it with the version of the Linode CLI built with Python 3.

Uninstalling the Python 2 CLI

Before proceeding, users should first uninstall the Python 2 based version of the Linode CLI from their Linode using python 2’s package manager pip:

sudo pip uninstall linode-cli

While uninstalling, you may be prompted to agree to the removal of some configuration files. Select Y to proceed and complete the removal process.

Installing the Python 3 Linode CLI

The upgrade path for the Python 3 Linode CLI depends on the Distro and package manager that you’re using.

Ubuntu/Debian

  1. Ensure that all available packages are up to date:

    sudo apt update
    
  2. Install python3 and pip3:

    sudo apt install python3 && sudo apt install python3-pip
    
  3. Install the Linode CLI using pip3:

    sudo pip3 install linode-cli
    

CentOS/RHEL Stream and Fedora

  1. Ensure that all available packages are up to date:

    dnf upgrade
    
  2. Install python3 and pip3:

    sudo dnf install python3 && sudo dnf install python3-pip
    
  3. Install the Linode CLI using pip3:

    sudo pip3 install linode-cli
    

CentOS 7

  1. Ensure that all available packages are up to date:

    sudo yum update
    
  2. Install python3 and pip3:

    sudo yum install python3 && sudo yum install python3-pip
    
  3. Install the Linode CLI using pip3:

    sudo pip3 install linode-cli
    

Windows 10

  1. Download the latest stable Windows package for python3 for your system at Python’s Downloads Page.

  2. Open up the installer .exe to begin the python installation process using Window’s GUI.

  3. Before proceeding, ensure that your version of Python is added to PATH by checking the box which enables this option:

Python WIndows Path Option

  1. Select the Customize Installation option to proceed.

  2. Ensure that pip all desired optional features are selected before proceeding to the next step. The pip installation is required by the Linode CLI.

  3. In the next step, ensure that the Install for all users option is enabled. Your configuration should reflect the following:

Python on Windows Advanced Options

  1. Select Next to proceed with the installation. Once the installation is complete, a message will confirm Python3 was successfully installed will appear that can be safely closed.

  2. Open the windows command prompt and enter the following command to complete installation of the Linode CLI:

    pip3 install linode-cli
    

Mac OSx

By default, python3 should already be installed and configured on the latest versions of Mac OSx. If for whatever reason it is not, you can use brew to install python3 which will additionally include pip:

brew install python3

Next Steps

To confirm the Linode CLI has successfully been installed, the following command may be entered:

linode-cli --version

If your installation was successful, the latest version of Linode CLI will be outputted.

Once the Linode CLI is installed, no further steps should be needed for configuration as both python based versions of the CLI will use a configuration file that will persist between the change. If for whatever reason you need to reconfigure the Linode CLI, the following command may be entered:

linode-cli configure

For more information on how to use the Linode CLI, see our Overview Guide

More Information

You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.

This page was originally published on


Your Feedback Is Important

Let us know if this guide made it easy to get the answer you needed.


Join the conversation.
Read other comments or post your own below. Comments must be respectful, constructive, and relevant to the topic of the guide. Do not post external links or advertisements. Before posting, consider if your comment would be better addressed by contacting our Support team or asking on our Community Site.