2

When I try to run a bot, I get this error message in the terminal:

zass@zass-system-product-name:~/python-telegram-bot/examples$python 
echobot.py
/usr/local/lib/python2.7/dist-packages/python_telegram_bot-8.0-
py2.7.egg/telegram/utils/request.py:38: UserWarning: python-telegram-
bot wasn't properly installed. Please refer to README.rst on how to 
properly install.
Traceback (most recent call last):
File "echobot.py", line 8, in <module>
import telegram 
File "build/bdist.linux-x86_64/egg/telegram/__init__.py", line 94, in 
<module>
File "build/bdist.linux-x86_64/egg/telegram/bot.py", line 34, in 
<module>
File "build/bdist.linux-x86_64/egg/telegram/utils/request.py", line 
33, in <module>
ImportError: No module named ptb_urllib3.urllib3

I'm running Python 2.7 on ubuntu, git and telegram bot are installed. - How can I fix it?

phd
  • 82,685
  • 13
  • 120
  • 165
Sami Soheili
  • 123
  • 1
  • 1
  • 10

3 Answers3

0

First of all make sure you have urllib3 installed. Sometimes urllib3 installation breaks. If for some reason your install of urllib3 is failing to include the util submodule, you could simply download the archive from the pypi page and copy the util folder from there to your urllib3 install location.

You may also issue the command below to get an up-to-date version:

sudo pip install urllib3 --upgrade

Then, see where your module is by starting a python interpreter and check where the urllib3 module is being loaded from:

python -c "import urllib3; print urllib3.__file__"

If all the above didn't work for you, make sure you're importing it right! and make sure there is no conflict.

Ali Hashemi
  • 3,158
  • 3
  • 34
  • 48
0

If you clone the python-telegram-bot repo you need to run the following command before installing the code:

git submodule update --init --recursive

Then install the code with python setup.py install

Jonas Lejon
  • 3,189
  • 3
  • 28
  • 26
0

Maybe you have 2 version of python and default version is 3.x Try to check version of python python -V if default version is 3 then run your code with python version 2.

python2 echobot.py

it can be python2 or python2.7

Also it can be cause of versions of libs

Arkhatinho
  • 21
  • 6