Python error when attempting to install linode-cli on Ubuntu Server 22.04.1
System is minimal fully upgraded Ubuntu 22.04.1 server install. I've created an API token, installed python3 and linode-cli using the recommended method. When trying to configure the token I'm getting a Python error.
$: sudo apt install python3 && sudo apt install python3-pip
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
python3 is already the newest version (3.10.6-1~22.04).
python3 set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
python3-pip is already the newest version (22.0.2+dfsg-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
$: sudo pip3 install linode-cli
Collecting linode-cli
Using cached linode_cli-5.27.2-py2.py3-none-any.whl (94 kB)
Requirement already satisfied: terminaltables in /usr/local/lib/python3.10/dist-packages (from linode-cli) (3.1.10)
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (from linode-cli) (2.25.1)
Requirement already satisfied: PyYAML in /usr/lib/python3/dist-packages (from linode-cli) (5.4.1)
Installing collected packages: linode-cli
Successfully installed linode-cli-5.27.2
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
$: linode-cli configure --token
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
"Create a Personal Access Token". The CLI needs access to everything
on your account to work correctly.
Personal Access Token: [TOKEN_REDACTED]
Configuring [USERNAME_REDACTED]
Could not contact https://api.linode.com/v4/account/users - Error: 401
Traceback (most recent call last):
File "/usr/local/bin/linode-cli", line 5, in <module>
from linodecli import main
File "/usr/local/lib/python3.10/dist-packages/linodecli/__init__.py", line 31, in <module>
cli = CLI(VERSION, BASE_URL, skip_config=skip_config)
File "/usr/local/lib/python3.10/dist-packages/linodecli/cli.py", line 41, in __init__
self.config = CLIConfig(self.base_url, skip_config=skip_config)
File "/usr/local/lib/python3.10/dist-packages/linodecli/configuration.py", line 93, in __init__
self.configure()
File "/usr/local/lib/python3.10/dist-packages/linodecli/configuration.py", line 555, in configure
auth_users = [u["username"] for u in self._do_get_request(
KeyError: 'data'
Help resolving this would be appreciated.
1 Reply
HTTP 401 is similar to HTTP 403 - Forbidden, but specifically for use when authentication is possible but has failed or not yet been provided. The response must include a WWW-Authenticate header field containing a challenge applicable to the requested resource.
I'd contact support about this. They know more about how the inner workings of CLI function -- especially on the server end.
-- sw