Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImportError: cannot import name 'InsecureRequestWarning' (PYTHON3 | RPI3 | gTTS)

I'm having trouble using gTTS (Google Text to Speech) on my raspberry Pi 3. I simply did

sudo pip3 install gTTS

to install it. But when I run my code I find this error :


File "interface.py", line 7, in <module>

from gtts import *

File "/usr/local/lib/python3.4/dist-packages/gtts/\__init__.py", line 2, in <module>

from .tts import gTTS

File "/usr/local/lib/python3.4/dist-packages/gtts/tts.py", line 4, in <module>
 from requests.packages.urllib3.exceptions import InsecureRequestWarning

ImportError: cannot import name 'InsecureRequestWarning'

To try to solve the problem I did

sudo easy_install --upgrade pip

Then I have uninstalled and installed again gtts but the problem persists.

Thank you very much for your help ! :(

PS : I have installed python-vlc and mutagen to make working gTTS (as I did on a windows device)

like image 614
sr_fpms_ig Avatar asked Apr 19 '17 15:04

sr_fpms_ig


3 Answers

Just update requests library

pip install -U requests
like image 200
hspandher Avatar answered Nov 03 '22 21:11

hspandher


Try this way.`

import urllib3`
urllib3.disable_warnings()

Though it doesn't remove the entire warning message, still removes the Insecure Request Warning

like image 1
Vikram Sharma Avatar answered Nov 03 '22 21:11

Vikram Sharma


Fixed it by running pip install requests==2.6.0

if you face issue with bringing request library to 2.6.0 first remove pyopenssl and then run pip install requests==2.6.0

like image 1
MD5 Avatar answered Nov 03 '22 21:11

MD5