Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python 'speedtest' has no attribute 'Speedtest'

I am trying to get the download and upload speed in python by using the "speedtest" module, but it gives me that error when I use the module:

AttributeError: module 'speedtest' has no attribute 'Speedtest'.

and I was only declaring the variable, that is my code :

import speedtest

speedtester = speedtest.Speedtest()

The module actually doesn't have the functions for some reason. Please tell me what is wrong with my code I was sure to import the module from the cmd and also the pycharm terminal and still got the same error. Thanks in advance

like image 548
PXL Desiner Avatar asked Aug 22 '26 21:08

PXL Desiner


2 Answers

I had the same issue. I was using PyCharm IDE. The issue occurs when you install speedtest using pip install speedtest In order to solve the above mentioned issue, you need to use the following command.

pip install speedtest-cli

But before doing this, uninstall the previous one by using pip uninstall speedtest Screenshot to installation

like image 126
Hassan Shahzad Avatar answered Aug 25 '26 10:08

Hassan Shahzad


I was getting the same error. Then I google the problem and eventually came here. Later I realised that I have named my python file speedtest.py. I renamed it to something else (which is not the name of any python module) and it works just fine now.

<--Screenshot-->

So make sure this case.

like image 39
hDmtP Avatar answered Aug 25 '26 10:08

hDmtP



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!