How do I install the Linode-CLI?

Linode Staff

I am trying to install the Linode CLI from a new Debian 10 linode. Here is what happens when I try to install it:

root@localhost:~# pip install linode-cli
-bash: pip: command not found

2 Replies

The Linode-CLI is intended to work with either Python 2 or Python 3 as long as you use
appropriate pip command. In other words, the pip or pip3 you are using needs to correspond to the the version of Python you are running. This can get very confusing especially when running multiple versions of Python2 or Python3.

The Linode provided Debian 10 installation does not include Python3 or pip by default, but can be installed with apt-get later. After deploying a Debian 10 Linode and running:

apt-get update && apt-get upgrade

The system was running the 2.7.16 version of Python.

Debian and Ubuntu have their own preferred way of handling Python.

root@localhost:~# python -m ensurepip --default-pip
ensurepip is disabled in Debian/Ubuntu for the system python.

Python modules For the system python are usually handled by dpkg and apt-get.

    apt-get install python-<module name>

Install the python-pip package to use pip itself.  Using pip together
with the system python might have unexpected results for any system installed
module, so use it on your own risk, or make sure to only use it in virtual
environments.

I was able to run the following:

root@localhost:~# apt-get install python3
.
[omitted]
.
root@localhost:~# apt-get install python3-pip
.
[omitted]
.
root@localhost:~# pip3 install linode-cli
.
[omited]
.
root@localhost:~# linode-cli
Welcome to the Linode CLI.  This will walk you through some
initial setup.

First, we need a Personal Access Token.  To get one, please visit
https://cloud.linode.com/profile/tokens and click
"Add a Personal Access Token".  The CLI needs access to everything
on your account to work correctly.
Personal Access Token: 

Doing it this way avoids the need to install Python2's pip which the Ubuntu/Debian package maintainers advise against.

Note that this package does not create a Symlink from pip to pip3, other packages for other systems might.

A word of caution: Many quick and dirty suggestions lurk on the internet about changing the symlink for /usr/bin/python to point to /usr/bin/python3 in an attempt to make it the default. This can break things on your system as many system scripts will depend on Python being Python2. This way leads to madness when your system runs into subtle bugs due to disparities between the two Pythons.

Instead, if you must have your python3 called python, you can put an alias for your shell in your ~/.bash_profile. (~/.bashrc is only run by interactive, non-login shells so it may cause odd problems if you call a Python3 program from another script and having it accidentally run from Python2. Additionally ~/.profile is only read by login shells.)

Please see the following guide for additional assistance with the Linode-CLI:

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct