[FIXED]: partially initialized module 'inspect' has no attribute 'cleandoc' Read this article in: EnglishSpanishPortuguêsRussian Python & Pytorch Issue 2024Q1 (current) The problem was naming a local module with the same name as an imported module. I had a file called ./tokenize.py and moving it to ./run_tokenize.py solved the problem.