Problem with speedtest-cli
Sebastian Wright
I get this error when i try to run the command
Retrieving speedtest.net configuration...
Traceback (most recent call last): File "/usr/bin/speedtest", line 11, in <module> load_entry_point('speedtest-cli==2.1.2', 'console_scripts', 'speedtest')() File "/usr/lib/python3/dist-packages/speedtest.py", line 1986, in main shell() File "/usr/lib/python3/dist-packages/speedtest.py", line 1872, in shell speedtest = Speedtest( File "/usr/lib/python3/dist-packages/speedtest.py", line 1091, in __init__ self.get_config() File "/usr/lib/python3/dist-packages/speedtest.py", line 1173, in get_config ignore_servers = list(
ValueError: invalid literal for int() with base 10: '' 2 3 Answers
Run this in Terminal:
sudo apt remove speedtest-cli
sudo apt install python-pipor python3-pip on 20.04 or newer
pip install speedtest_cli
speedtest 2 The answer points to the correct solution, however, here is what I did:
Remove the package
$ sudo apt remove speedtest-cli [sudo] password for user: Reading package lists... Done Building dependency tree Reading state information... Done The following packages will be REMOVED: speedtest-cli 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. After this operation, 106 kB disk space will be freed. Do you want to continue? [Y/n] (Reading database ... 434307 files and directories currently installed.) Removing speedtest-cli (2.1.2-2) ... Processing triggers for man-db (2.9.1-1) ...Install the speedtest_cli package using pip3
$ pip3 install speedtest_cli Collecting speedtest_cli Downloading speedtest_cli-2.1.3-py2.py3-none-any.whl (23 kB) Installing collected packages: speedtest-cli WARNING: The scripts speedtest and speedtest-cli are installed in '/home/user/.local/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. Successfully installed speedtest-cli-2.1.3Run
vim ~/.profile(or use your favourite text editor) and add this line at the end:PATH="$PATH:$HOME/.local/bin"save the file run
source ~/.profile(editor's note: this step may be unnecessary as
.profilemay contain a line that adds.local/binto PATH if it exists - read the file first.)Run the program
$ speedtest Retrieving speedtest.net configuration... Testing from Asahi Net (14.3.70.30)... Retrieving speedtest.net server list... Selecting best server based on ping... Hosted by GLBB Japan (Tokyo) [2.12 km]: 6.547 ms Testing download speed................................................................................ Download: 74.92 Mbit/s Testing upload speed...................................................................................................... Upload: 173.11 Mbit/s
My system: Ubuntu 20.04 64-bit - Enjoy!
3This worked for me.
Open the
speedtest.pyfile in/usr/lib/python3/dist-packageswith a text editor.Go to line 1174:
map(int, server_config['ignoreids'].split(','))and replace it with this one:
map(int, (server_config['ignoreids'].split(',') if len(server_config['ignoreids']) else []) )Save the file and run the command again.
You can also comment the line placing # at the beginning and add the new line. If this solution doesn't work for you, you can restore the original file easily, uncommenting the old line and deleting the new one.