Search code examples
pythonpython-3.xlinuxpython-modulekali-linux

Already installed Python module undetected when running Python script. 'tdqm'


'tdqm' module not found even though it is installed.

I have a Python script containing the line from tdqm import tdqm, but when I try to run using the command python3 script.py, it returns back the error message:

Traceback (most recent call last):
  File "/home/username/Downloads/folder/script.py", line 2, in <module>
    from tdqm import tdqm

I used pip show tdqm command with all the installed Python versions on my machine and they all detect the module, giving the output:

Name: tdqm
Version: 0.0.1
Summary: Alias for typos of tqdm
Home-page: https://github.com/tqdm/tqdm
Author: 
Author-email: 
License: MPLv2.0
Location: /home/username/.local/lib/python3.11/site-packages
Requires: tqdm
Required-by: 

When I try to install it again using the command pip3 install tdqm, I get the message:

Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: tdqm in /home/username/.local/lib/python3.11/site-packages (0.0.1)
Requirement already satisfied: tqdm in /usr/lib/python3/dist-packages (from tdqm) (4.64.1)

I also tried uninstalling and installing it again with different versions of pip, but it still didn't work.

I can find the module in the specified path, and I tried running the script as my user as well as as the root user.

I am working on kali linux and I couldn't find a solution to this problem, any help would be appreciated.


Solution

  • The module is called tqdm, not tdqm.

    However there is a package called tdqm that simply depends on the proper package:

    Alias for typos of tqdm.

    Typing it wrong should work when installing, but when you use it you'll have to spell it correctly:

    from tqdm import tqdm