File "c:\TelegramBot\telegram.py", line 1, in <module>
import telegram.ext
ModuleNotFoundError: No module named 'telegram.ext'; 'telegram' is not a package
I had installed python telegram bot by using the command pip install python-telegram-bot
I tried many ways but still showing the same error. can u resolve this error
2
Answers
I think your file name is “telegram.py”. Rename it to something else to see if the error fixes. Because python tries to import the file with that name. Also I assume that you have installed it in virtual environment. I you have not, please create a virtual environment and install the package again while the environment is activated.
There are a few possible options:
pip uninstall python-telegram-bot
, than reinstall it withpip install python-telegram-bot
. Try doing it in the root folder of your project, then check if it’s actually installed doingpip show python-telegram-bot
.