Debian 10.9 speedtest-cli Workaround

Posted on Wed 14 April 2021 in Debian

What Is Wrong...

A command line version of (speedtest-cli) used to work under previous versions of Debian 10. However, when I tried it on 10.9, it is broken and gives the error:

Retrieving configuration...
Traceback (most recent call last):
  File "/usr/bin/speedtest-cli", line 11, in <module>
    load_entry_point('speedtest-cli==2.0.2', 'console_scripts', 'speedtest-cli')()
  File "/usr/lib/python3/dist-packages/", line 1887, in main
  File "/usr/lib/python3/dist-packages/", line 1783, in shell
  File "/usr/lib/python3/dist-packages/", line 1027, in __init__
  File "/usr/lib/python3/dist-packages/", line 1113, in get_config
    map(int, server_config['ignoreids'].split(','))
ValueError: invalid literal for int() with base 10: ''

The Workaround

First of all, frome the command line, uninstall speedtest-cli:

% sudo apt purge speedtest-cli

Second, create a directory for the new one. I like to keep my Python scripts in the src folder.

% mkdir -p ~/src/speedtest
% cd ~/src/speedtest

Next, make sure that you have the python3-venv package installed:

% sudo apt install python3-venv

Finally, issue the following commands:

% python3 -m venv venv
% source venv/bin/activate
(venv) % python -m pip install --upgrade pip setuptools

Cache entry deserialization failed, entry ignored
Collecting pip
  Using cached
Collecting setuptools
  Using cached
Installing collected packages: pip, setuptools
  Found existing installation: pip 18.1
    Uninstalling pip-18.1:
      Successfully uninstalled pip-18.1
  Found existing installation: setuptools 40.8.0
    Uninstalling setuptools-40.8.0:
      Successfully uninstalled setuptools-40.8.0
Successfully installed pip-21.0.1 setuptools-56.0.0

(venv) % python -m pip install speedtest-cli

Collecting speedtest-cli
  Using cached speedtest_cli-2.1.3-py2.py3-none-any.whl (23 kB)
Installing collected packages: speedtest-cli
Successfully installed speedtest-cli-2.1.3

Now, you can run the speedtest-cli command to get your speeds. If you're using zsh, you may need to issue the rehash command for the new command to be found.

How To Keep Using The Workaround

It is normal, after this, to have a command not found error when running speedtest-cli. This is because the Python3 virtual environment has not been setup. To fix this, issue the following command:

% source ~/src/speedtest/venv/bin/activate

It will work after that. When you are done using speedtest-cli you can stop using the Python3 virtual environment by issuing the deactivate command.