ModuleNotFoundError: No module named 'telegram' after pip install
Asked Answered
D

5

6

After running pip install python-telegram-bot, I'm getting this error that the 'telegram' module is not found.

Under pip list I see that my python-telegram-bot package is installed version 13.2

Is anyone else getting this error?

Dossal answered 17/2, 2021 at 6:41 Comment(2)
Hint: 2 different Pythons.Cuculiform
Indeed it might be due to different Python installation. I am using Mac which comes with python 2. I installed a separate python using brew and I forgot about it. If you install python using brew, you can check the location of python binary using "brew list [email protected]".Salaried
D
1

pip3 install python-telegram-bot

Install it in outside of virutal environment in terminal. Also unintall telegram. python-telegram-bot is sufficient for Telegram bot. In my case it resolved my issue.

Decato answered 11/5, 2022 at 2:58 Comment(0)
J
0

Try another way to install it

first remove it pip3 uninstall python-telegram-bot

Clone and install

git clone https://github.com/python-telegram-bot/python-telegram-bot
cd python-telegram-bot
python3 setup.py install
pip3 install python-telegram-bot

It should work

Jade answered 14/12, 2021 at 23:43 Comment(0)
I
0

I also had this problem - for me the issue was that I was trying to run my code from a module called telegram.py. Newbie mistake I know...

Integument answered 28/2, 2022 at 21:29 Comment(0)
F
0

Do 1-2 via terminal and 4 on your IDE:

Install pip install telegram Install pip install python-telegram-bot If you are using a virtual environment, make sure it is activated Lastly, **import from telegram.ext import ***

Filberte answered 9/1, 2023 at 22:16 Comment(0)
S
0

I had the same problem, this is how I solved it:

  1. Open Windows PowerShell as an administrator.
  2. Run the following command: Get-ExecutionPolicy.
  3. If the previous command shows it is set to restricted, change it to allow remote sign using Set-ExecutionPolicy RemoteSigned.
  4. Open your terminal and run pip install python-telegram-bot to install the bot again.
Skipper answered 29/5, 2023 at 9:16 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.